Hello, I want to convert summation of below problem into matlab code

1 次查看(过去 30 天)
This is the expanded value of H33
H33=[(U(1,3)*U(1,3))]./[(w(1,1).^2-w.^2)]+[(U(2,3)*U(2,3))]./[(w(2,2).^2-w.^2)]+[(U(3,3)*U(3,3))]./[(w(3,3).^2-w.^2)]+[(U(4,3)*U(4,3))]./[(w(4,4).^2-w.^2)]+[(U(5,3)*U(5,3))]./[(w(5,5).^2-w.^2)]+[(U(6,3)*U(6,3))]./[(w(6,6).^2-w.^2)];
H34=[(U(1,3)*U(1,4))]./[(w(1,1).^2-w.^2)]+[(U(2,3)*U(2,4))]./[(w(2,2).^2-w.^2)]+[(U(3,3)*U(3,4))]./[(w(3,3).^2-w.^2)]+[(U(4,3)*U(4,4))]./[(w(4,4).^2-w.^2)]+[(U(5,3)*U(5,4))]./[(w(5,5).^2-w.^2)]+[(U(6,3)*U(6,4))]./[(w(6,6).^2-w.^2)];
H35=[(U(1,5)*U(1,3))]./[(w(1,1).^2-w.^2)]+[(U(2,5)*U(2,3))]./[(w(2,2).^2-w.^2)]+[(U(3,5)*U(3,3))]./[(w(3,3).^2-w.^2)]+[(U(4,5)*U(4,3))]./[(w(4,4).^2-w.^2)]+[(U(5,5)*U(5,3))]./[(w(5,5).^2-w.^2)]+[(U(6,5)*U(6,3))]./[(w(6,6).^2-w.^2)];
I tried writing it as
S1=0;
for r=(1:6)
S1=S1+[sum(U(r,3)*U(r,3))]/[sum(w(1,r).^2-w.^2)];
end
S2=0;
for r=(1:6)
S2=S2+[sum(U(r,3)*U(r,4))]/[sum(w(1,r).^2-w.^2)];
end
S3=0;
for r=(1:6)
S3=S3+[sum(U(r,5)*U(r,3))]/[sum(w(1,r).^2-w.^2)];
end
z2=S1+(ay3*S2)-(ax3*S3);
Is this correct?

回答(1 个)

Sai Sri Pathuri
Sai Sri Pathuri 2019-9-3
编辑:Sai Sri Pathuri 2019-9-3
There is no need of summation in the expressions of S1, S2 and S3. Try using the following equations.
S1=S1+[U(r,3)*U(r,3)]./[w(r,r).^2-w.^2];
S2=S2+[U(r,3)*U(r,4)]./[w(r,r).^2-w.^2];
S3=S3+[U(r,3)*U(r,5)]./[w(r,r).^2-w.^2];

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by