How can I multiply two different sized objects?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Florea George
le 8 Jan 2019
Réponse apportée : madhan ravi
le 8 Jan 2019
%Matrix dimensions must agree.
A = 1;
pas = 1/1000;
t=-10:pas:10;
k=10;
omega = -k*pi/A:1/10:k*pi/A;
x=omega.*t;
%The error appears on the last line where x is. how can i multiply them?
0 commentaires
Réponse acceptée
madhan ravi
le 8 Jan 2019
omega = linspace(-k*pi/A,k*pi/A,numel(t)); % change your line to this
0 commentaires
Plus de réponses (1)
Totanly
le 8 Jan 2019
you can't multiply two different sized vectors. Follow the matrix multiplication rules.
if A=first matrix and B=second matrix
size(A) should be Size(B) for element by element multiplication;
no of columns of A= no of rows of B for matrix multiplication
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!