Error using / Matrix dimensions must agree.
古いコメントを表示
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."
回答 (2 件)
James Tursa
2016 年 10 月 25 日
編集済み: James Tursa
2016 年 10 月 25 日
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
2016 年 10 月 25 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!