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

1 Ansicht (letzte 30 Tage)
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?
  2 Kommentare
dpb
dpb am 29 Aug. 2019
Bearbeitet: dpb am 29 Aug. 2019
Dunno...breaks my eyes to try to look at. Do you get same answers?
Akshay Mallikarjun Puttallavar
In simple it is,
Hij= (Summation r=1:6) [(U(i,r)*U(j,r))/(wr^2-w^2)]

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sai Sri Pathuri
Sai Sri Pathuri am 3 Sep. 2019
Bearbeitet: Sai Sri Pathuri am 3 Sep. 2019
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];

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by