where is the mistake in my programing?

1 visualizzazione (ultimi 30 giorni)
clc
syms c h k
c11=106.8;
c33=54.57;
c13=9.68;
c15=0.28;
c35=-1.69;
c55=25.05;
r1=2727;
l=2.46;
u=5.66;
r2=7800;
i=sqrt(-1);
n=2.54;
a=fix(c33*c55);
b=fix(c35^2);
d=fix(c15*c33);
e=fix(c13*c35);
f=fix(c33+c55);
g=fix(c15*c35);
j=fix(c11*c33);
m=fix(c13^2);
o=fix(c13*c55);
p=fix(c55+c11);
q=fix((c11*c55)-c15^2);
r=fix(c15+c35);
t=fix(c11*c35-c13*c15);
a0=a-b;
a1=-2*i*(d-e);
a2=f*r1*(c^2)-2*g-j+m+2*o;
a3=-2*i*(r*r1*(c^2)-t);
a4=(r1^2)*(c^4)-p*r1*(c^2)+q;
s=[a0 a1 a2 a3 a4];
root=roots(s);
s1=root(1,1)
s2=root(2,1)
s3=root(3,1)
s4=root(4,1)
m1=-(fix(c55)*fix(s1^2)-2*i*fix(c15)*fix(s1)+r1*(c^2)-fix(c11))/(fix(c35)*fix(s1^2)-i*fix(c13+c55)*fix(s1)-fix(c15));
m1=simplify(m1,'steps',20)
m2=-(fix(c55)*fix(s2^2)-2*i*fix(c15)*fix(s2)+r1*(c^2)-fix(c11))/(fix(c35)*fix(s2^2)-i*fix(c13+c55)*fix(s2)-fix(c15));
m3=-(fix(c55)*fix(s3^2)-2*i*fix(c15)*fix(s3)+r1*(c^2)-fix(c11))/(fix(c35)*fix(s3^2)-i*fix(c13+c55)*fix(s3)-fix(c15));
m4=-(fix(c55)*fix(s4^2)-2*i*fix(c15)*fix(s4)+r1*(c^2)-fix(c11))/(fix(c35)*fix(s4^2)-i*fix(c13+c55)*fix(s4)-fix(c15));
m2=simplify(m2,'steps',20)
m3=simplify(m3,'steps',20)
m4=simplify(m4,'steps',20)
alpha=sqrt((l+2*u)/r2);
beta=sqrt(u/r2)
b0=(n^2)*((beta^2)/alpha^2);
b1=(n^2)*((1-((beta^2)/(alpha^2))^2))+n*(((c^2)/(alpha^2))-n)+n*((beta^2)/(alpha^2))*((c^2)/(beta^2)-n);
b2=((beta^2)/(alpha^2))*((c^2)/(alpha^2)-n)*((c^2)/(beta^2)-n);
p=[b0 0 b1 0 b2];
proot=roots(p);
p1=proot(1,1)
p2=proot(2,1)
p3=proot(3,1)
p4=proot(4,1)
n1=(((c^2)/(alpha^2))-n+n*((beta^2)/(alpha^2))*(p1^2))/(i*n*(1-((beta^2)/(alpha^2))*p1))
n2=(((c^2)/(alpha^2))-n+n*((beta^2)/(alpha^2))*(p2^2))/(i*n*(1-((beta^2)/(alpha^2))*p2))
K1=i*fix(c15)-m1*s1*fix(c35)+(i*m1-s1)*fix(c55);
K2=i*fix(c15)-m2*s2*fix(c35)+(i*m2-s2)*fix(c55);
K3=i*fix(c15)-m3*s3*fix(c35)+(i*m3-s3)*fix(c55);
K4=i*fix(c15)-m4*s4*fix(c35)+(i*m4-s4)*fix(c55);
K5=i*fix(c13)-m1*s1*fix(c33)+(i*m1-s1)*fix(c35);
K6=i*fix(c13)-m2*s2*fix(c33)+(i*m2-s2)*fix(c35);
K7=i*fix(c13)-m3*s3*fix(c33)+(i*m3-s3)*fix(c35);
K8=i*fix(c13)-m4*s4*fix(c33)+(i*m4-s4)*fix(c35);

Risposta accettata

Walter Roberson
Walter Roberson il 2 Ago 2022
No comments. That would be an automatic Fail for university assignments.
  1 Commento
Walter Roberson
Walter Roberson il 2 Ago 2022
The code executes for me. I have no idea whether it produces the desired results, as there is no documentation as to what results are desired and no error message was provided.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by