Error using / Matrix dimensions must agree.
Mostra commenti meno recenti
I wanna draw a abs graph of a function that is 1/2j*( 1 / ( 1-exp( jTs(10-w) ) ) - 1/( 1-exp( -jTs( 10+w ) ) ) ) ) in frequency domain, and my code is below :
>> w=1:0.01:100;
>> y=abs(1/complex(0,2)*( 1/(1-exp(complex(0,-Ts*w))*exp(complex(0,10*Ts)))-1/(1-exp(complex(0,-
Ts*w))*exp(0,-10*Ts))))
Error using /
Matrix dimensions must agree.
>> figure(1);subplot(1,1,1);plot(w,y);
Undefined function or variable 'y'.
How can I solve the error below "Error using / Matrix dimensions must agree."
Risposte (2)
James Tursa
il 25 Ott 2016
Modificato: James Tursa
il 25 Ott 2016
Use element-wise operators .* and ./ instead of matrix operators * and /
y=abs(1/complex(0,2)*( 1./(1-exp(complex(0,-Ts*w)).*exp(complex(0,10*Ts)))-1./(1-exp(complex(0,-Ts*w)).*exp(0,-10*Ts))))
KSSV
il 25 Ott 2016
0 voti
You are using w a vector, you have to use matrix element by element multiplication.. check your y part again and use ./ and .* where ever required. check matrix element wise operations.
Categorie
Scopri di più su Operators and Elementary Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!