How can I multiply an indexed vector by scalar?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
JAYEN PILLAY
le 6 Avr 2020
Réponse apportée : Steven Lord
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 ?
0 commentaires
Réponse acceptée
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);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!