How to code summation equation?

4 ビュー (過去 30 日間)
Ferhat Yamaç UZUN
Ferhat Yamaç UZUN 2019 年 12 月 7 日
編集済み: per isakson 2019 年 12 月 7 日
Hello everyone !
I've got a graudation project and i stucked in here. I'm trying to do same process with a difference that I have one more V as V4 and our summations should go 1 to 4.
As a summary I got M matrice but I cannot write a code for V1,V2,V3 and V4.
Here is the my code: in this code we can find the M matrice as 4x4. Also the qs are in upper summation formula are represented as Q1,Q2,Q3 and Q4 in my code:
syms Q1 Q2 Q3 Q4 a1 s2 a3 a4 m1 m2 m3 m4
A01 = [cosd(Q1),-sind(Q1),0;sind(Q1),cosd(Q1),0;0,0,1];
A12 = [1,0,0;0,0,-1;0,1,0];
A23 = [cosd(Q3),-sind(Q3),0;sind(Q3),cosd(Q3),0;0,0,1];
A34 = [cosd(Q4),-sind(Q4),0;sind(Q4),cosd(Q4),0;0,0,1];
A04 = simplify(A01*A12*A23*A34);
A03 = simplify(A01*A12*A23);
A02 = simplify(A01*A12);
AT04 = transpose(A04);
AT03 = transpose(A03);
AT02 = transpose(A02);
AT01 = transpose(A01);
I11 = ((1/12)*m1*(a1^2))*[0,0,0;0,1,0;0,0,1];
I22 = ((1/12)*m2*(s2^2))*[1,0,0;0,1,0;0,0,0];
I33 = ((1/12)*m3*(a3^2))*[0,0,0;0,1,0;0,0,1];
I44 = ((1/12)*m4*(a4^2))*[0,0,0;0,1,0;0,0,1];
I1=A01*I11*AT01;
I2=A02*I22*AT02;
I3=A03*I33*AT03;
I4=A04*I44*AT04;
Jv1 = [0,0,0,0;0,0,0,0;0,0,0,0];
Jw1 = [0,0,0,0;0,0,0,0;1,0,0,0];
Jv2 = [0,0,0,0;0,0,0,0;1,1,0,0];
Jw2 = [0,0,0,0;0,0,0,0;0,0,0,0];
Jv3 = [-(a3*cosd(Q3)*sind(Q1))/2,0,-(a3*sind(Q3))/2,0;(a3*cosd(Q1)*cosd(Q3))/2,(a3*cosd(Q3))/2,(a3*cosd(Q3))/2,0;0,0,0,0];
Jw3 = [0,0,0,0;0,0,0,0;1,1,1,0];
Jv4 = [-((sind(Q1))*(a3*cosd(Q3)+a4*cosd(Q3+Q4)))/2,0,-(a3*sind(Q3)+a4*sind(Q3+Q4))/2,-(a4*sind(Q4))/2;((cosd(Q1)*(a3*cosd(Q3)+a4*cosd(Q3+Q4))))/2,(a3*cosd(Q3)+a4*cosd(Q3+Q4))/2,(a3*cosd(Q3)+a4*cosd(Q3+Q4))/2,(a4*cosd(Q4))/2;0,0,0,0];
Jw4 = [0,0,0,0;0,0,0,0;1,1,1,1];
JvT1 = transpose(Jv1);
JwT1 = transpose(Jw1);
JvT2 = transpose(Jv2);
JwT2 = transpose(Jw2);
JvT3 = transpose(Jv3);
JwT3 = transpose(Jw3);
JvT4 = transpose(Jv4);
JwT4 = transpose(Jw4);
M = JvT1*m1*Jv1 + JwT1*I1*Jw1 + JvT2*m2*Jv2 + JwT2*I2*Jw2 + JvT3*m3*Jv3 + JwT3*I3*Jw3 + JvT4*m4*Jv4 + JwT4*I4*Jw4

回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by