How can I multiply an indexed vector by scalar?
1 view (last 30 days)
Show older comments
I have a vector B_ j that is twice phi_i :
and
phi_i = @(ii, m) atan( d + (ii*d)./m) ;
Why I can not write B_j = 2.*phi_i ?
0 Comments
Accepted Answer
Steven Lord
on 6 Apr 2020
phi_i is a function, not an array. You could write B_j as the product of a number and the value you obtained from evaluating phi_i:
phi_i = @(ii, m) atan( d + (ii*d)./m);
B_j = 2*phi_i(1:10, 2)
Or you could write B_j as a function of ii and m, like phi_i is:
B_j = @(ii, m) 2*phi_i(ii, m);
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!