How can I multiply an indexed vector by scalar?

1 vue (au cours des 30 derniers jours)
JAYEN PILLAY
JAYEN PILLAY le 6 Avr 2020
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 ?

Réponse acceptée

Steven Lord
Steven Lord le 6 Avr 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);

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by