필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Implement a particular equation

조회 수: 2 (최근 30일)
Tipu Sultan
Tipu Sultan 2018년 11월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello everyone ,
I am trying to use matlab where I have to implement a equation which is mentioned below; I tried to implement it but where
I got error saysing:
Error using +
Matrix dimensions must agree.
Error in test181118 (line 42)
K = prev_S*M'*(((W+M*S*M'))^-1);
My code:
S = [100 0 0 0 0 0;
0 100 0 0 0 0;
0 0 100 0 0 0;
0 0 0 100 0 0;
0 0 0 0 100 0;
0 0 0 0 0 100];
prev_S = S;
a=0;
b=0;
c=0;
p=0;
q=0;
s=0;
est_vec=[a ; b; c; p; q; s];
Big_lambda=[1 0 0;
0 1 0;
0 0 1];
theta = [45 60 90 ] ;
t= [ 10 20 30 ];
r= [ 10 20 30];
x = [ r; theta ; t];
for i=1:3
dif_x = [(-cos(theta(i))) (r(i).*sin(theta(i))) (2*a.*t(i)+b);(-sin(theta(i))) (-r(i).*cos(theta(i))) (2*p.*t(i)+q)];
W = dif_x(i).*Big_lambda.*dif_x(i)';
M = [t(i).^2 t(i) 1 0 0 0;
0 0 0 t(i).^2 t(i) 1];
K = prev_S*M'*(((W + M*prev_S*M'))^-1);
S = prev_S;
end
I am giving you dimension of the vectors and matrix:
prev_S = (6*6)
M = (2*6)
W = (3*3)
  댓글 수: 1
Stephen23
Stephen23 2018년 11월 18일
편집: Stephen23 2018년 11월 18일
Here are the two terms that you are trying to add:
>> W
W =
0.27596 0.00000 0.00000
0.00000 0.27596 0.00000
0.00000 0.00000 0.27596
>> M*prev_S*M'
ans =
1010100 0
0 1010100
How do you expect to add the elements of a 3x3 matrix and a 2x2 matrix?
More concretely, what does W(3,3) get added to? Once you can answer this question, then we can help you to fix your buggy code.

답변 (0개)

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by