Error using / Matrix dimensions must agree.
Show older comments
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."
Answers (2)
James Tursa
on 25 Oct 2016
Edited: James Tursa
on 25 Oct 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
on 25 Oct 2016
0 votes
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.
Categories
Find more on Operators and Elementary Operations 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!