MATLAB里怎么对符号变量表达式中的变量赋值
symsxyzabc;a=45*pi/180;b=90*pi/180;c=120*pi/180;Rx=[100;0cos(x)-sin(x);0sin(x)-cos(x)...
syms x y z a b c ;
a=45*pi/180;b=90*pi/180;c=120*pi/180;
Rx=[1 0 0;0 cos(x) -sin(x); 0 sin(x) -cos(x)];
Ry=[cos(y) 0 sin(y);0 1 0;-sin(y) 0 cos(y)];
Rz=[cos(z) -sin(z) 0;sin(z) cos(z) 0;0 0 1];
D=Rx*Ry*Rz;
B1=[80*cos(a);-56;80*sin(a)];
A1=[40*cos(a);0;40*sin(a)];
M1=D*B1-A1;
L1=M1.^2;
L11=sum(sum(sum(L1)));
B2=[80*cos(a+b);-56;80*sin(a+b)];
A1=[40*cos(a+b);0;40*sin(a+b)];
M2=D*B2-A1;
L2=M2.^2;
L22=sum(sum(sum(L2)));
B3=[80*cos(c-b);-56;80*sin(c-b)];
A3=[40*cos(c-b);0;40*sin(c-b)];
M3=D*B3-A3;
L3=M3.^2;
L33=sum(sum(sum(L3)));
O=[0;-56;0];
N=D*O;
P=N'*O;
Q=P/3136;
sym(N1)=diff(L11,x);
sym(N2)=diff(L11,y);
N3=diff(L11,z);
N4=diff(L22,x);
N5=diff(L22,y);N6=diff(L22,z);
N7=diff(L33,x);
N8=diff(L33,y);
N9=diff(L33,z);
能得到表达式,但有点怪如图,表达式很长贴不下
但接下来对这个矩阵表达式赋值 展开
a=45*pi/180;b=90*pi/180;c=120*pi/180;
Rx=[1 0 0;0 cos(x) -sin(x); 0 sin(x) -cos(x)];
Ry=[cos(y) 0 sin(y);0 1 0;-sin(y) 0 cos(y)];
Rz=[cos(z) -sin(z) 0;sin(z) cos(z) 0;0 0 1];
D=Rx*Ry*Rz;
B1=[80*cos(a);-56;80*sin(a)];
A1=[40*cos(a);0;40*sin(a)];
M1=D*B1-A1;
L1=M1.^2;
L11=sum(sum(sum(L1)));
B2=[80*cos(a+b);-56;80*sin(a+b)];
A1=[40*cos(a+b);0;40*sin(a+b)];
M2=D*B2-A1;
L2=M2.^2;
L22=sum(sum(sum(L2)));
B3=[80*cos(c-b);-56;80*sin(c-b)];
A3=[40*cos(c-b);0;40*sin(c-b)];
M3=D*B3-A3;
L3=M3.^2;
L33=sum(sum(sum(L3)));
O=[0;-56;0];
N=D*O;
P=N'*O;
Q=P/3136;
sym(N1)=diff(L11,x);
sym(N2)=diff(L11,y);
N3=diff(L11,z);
N4=diff(L22,x);
N5=diff(L22,y);N6=diff(L22,z);
N7=diff(L33,x);
N8=diff(L33,y);
N9=diff(L33,z);
能得到表达式,但有点怪如图,表达式很长贴不下
但接下来对这个矩阵表达式赋值 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询