필터 지우기
필터 지우기

My code continuously giving this error( Error using ./ Matrix dimensions must agree. Error in Untitled14 (line 16) k = zeta*(w./wd); )

조회 수: 2 (최근 30일)
zeta = g * q;
j= 1-power(zeta,2);
wd = w*power(j,1/2);
r=w./wd;
k = zeta*r;
l=k*sin(wd*t);
m=cos(wdt) + l;
n= - zeta*w*t;
p = 1 - exp(n)*(m);
plot (p)
  댓글 수: 4
arif hussain
arif hussain 2017년 6월 12일
Error using ./ Matrix dimensions must agree.
Error in Untitled14 (line 16) r=w./wd;

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 6월 14일
You are using the / operator in several places. In MATLAB, A/B is more or less the same as A * pinv(B) . 1/w where w is 60 x 1, gives you a 1 x 60 result. Likewise, h = xt/ i where i is 60 x 1, gives you a 1 x 60 result. You then end up working with this mix of 60 x 1 and 1 x 60 and you end up with trying to combine arrays in the wrong way.
>> 1/[2;4;3]
ans =
0 0.25 0
Notice the output is a row vector for a column vector divisor.
If you would need the answer [0.5; 0.25; 0.3333] (column vector, individual divisions) instead for this calculation, then you need to use the ./ operator

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by