my program is not stop. please help

18 Ansichten (letzte 30 Tage)
neetu malik
neetu malik am 2 Aug. 2022
Kommentiert: neetu malik am 6 Aug. 2022
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=(c33*c55);
b=(c35^2);
d=(c15*c33);
e=(c13*c35);
f=(c33+c55);
g=(c15*c35);
j=(c11*c33);
m=(c13^2);
o=(c13*c55);
p=(c55+c11);
q=((c11*c55)-c15^2);
r=(c15+c35);
t=(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);
s2=root(2);
s3=root(3);
s4=root(4);
m1=-((c55)*(s1^2)-2*i*(c15)*(s1)+r1*(c^2)-(c11))/((c35)*(s1^2)-i*(c13+c55)*(s1)-(c15));
m2=-((c55)*(s2^2)-2*i*(c15)*(s2)+r1*(c^2)-(c11))/((c35)*(s2^2)-i*(c13+c55)*(s2)-(c15));
m3=-((c55)*(s3^2)-2*i*(c15)*(s3)+r1*(c^2)-(c11))/((c35)*(s3^2)-i*(c13+c55)*(s3)-(c15));
m4=-((c55)*(s4^2)-2*i*(c15)*(s4)+r1*(c^2)-(c11))/((c35)*(s4^2)-i*(c13+c55)*(s4)-(c15));
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);
p2=proot(2);
p3=proot(3);
p4=proot(4);
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*(c15)-m1*s1*(c35)+(i*m1-s1)*(c55);
K2=i*(c15)-m2*s2*(c35)+(i*m2-s2)*(c55);
K3=i*(c15)-m3*s3*(c35)+(i*m3-s3)*(c55);
K4=i*(c15)-m4*s4*(c35)+(i*m4-s4)*(c55);
K5=i*(c13)-m1*s1*(c33)+(i*m1-s1)*(c35);
K6=i*(c13)-m2*s2*(c33)+(i*m2-s2)*(c35);
K7=i*(c13)-m3*s3*(c33)+(i*m3-s3)*(c35);
K8=i*(c13)-m4*s4*(c33)+(i*m4-s4)*(c35);
e1=exp(k*s1*h);
e2=exp(k*s2*h);
e3=exp(k*s3*h);
e4=exp(k*s4*h);
A=[1 1 1 1 -1 -1; m1 m2 m3 m4 -n1 -n2; K1 K2 K3 K4 -n*u*(i*n1-p1) -n*u*(i*n2-p2); K5 K6 K7 K8 -n*(i*l-(l+2*u)*p1*n1) -n*(i*l-(l+2*u)*p2*n2); K1*e1 K2*e2 K3*e3 K4*e4 0 0; K5*e1 K6*e2 K7*e3 K8*e4 0 0];
D=det(A)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 2 Aug. 2022
tic
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=(c33*c55);
b=(c35^2);
d=(c15*c33);
e=(c13*c35);
f=(c33+c55);
g=(c15*c35);
j=(c11*c33);
m=(c13^2);
o=(c13*c55);
p=(c55+c11);
q=((c11*c55)-c15^2);
r=(c15+c35);
t=(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);
s2=root(2);
s3=root(3);
s4=root(4);
m1=-((c55)*(s1^2)-2*i*(c15)*(s1)+r1*(c^2)-(c11))/((c35)*(s1^2)-i*(c13+c55)*(s1)-(c15));
m2=-((c55)*(s2^2)-2*i*(c15)*(s2)+r1*(c^2)-(c11))/((c35)*(s2^2)-i*(c13+c55)*(s2)-(c15));
m3=-((c55)*(s3^2)-2*i*(c15)*(s3)+r1*(c^2)-(c11))/((c35)*(s3^2)-i*(c13+c55)*(s3)-(c15));
m4=-((c55)*(s4^2)-2*i*(c15)*(s4)+r1*(c^2)-(c11))/((c35)*(s4^2)-i*(c13+c55)*(s4)-(c15));
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);
p2=proot(2);
p3=proot(3);
p4=proot(4);
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*(c15)-m1*s1*(c35)+(i*m1-s1)*(c55);
K2=i*(c15)-m2*s2*(c35)+(i*m2-s2)*(c55);
K3=i*(c15)-m3*s3*(c35)+(i*m3-s3)*(c55);
K4=i*(c15)-m4*s4*(c35)+(i*m4-s4)*(c55);
K5=i*(c13)-m1*s1*(c33)+(i*m1-s1)*(c35);
K6=i*(c13)-m2*s2*(c33)+(i*m2-s2)*(c35);
K7=i*(c13)-m3*s3*(c33)+(i*m3-s3)*(c35);
K8=i*(c13)-m4*s4*(c33)+(i*m4-s4)*(c35);
e1=exp(k*s1*h);
e2=exp(k*s2*h);
e3=exp(k*s3*h);
e4=exp(k*s4*h);
A=[1 1 1 1 -1 -1; m1 m2 m3 m4 -n1 -n2; K1 K2 K3 K4 -n*u*(i*n1-p1) -n*u*(i*n2-p2); K5 K6 K7 K8 -n*(i*l-(l+2*u)*p1*n1) -n*(i*l-(l+2*u)*p2*n2); K1*e1 K2*e2 K3*e3 K4*e4 0 0; K5*e1 K6*e2 K7*e3 K8*e4 0 0];
syms AA [6 6]
detA = det(AA);
D = subs(detA, AA, A);
toc
Elapsed time is 18.705740 seconds.
  5 Kommentare
Walter Roberson
Walter Roberson am 3 Aug. 2022
try
AA = sym('AA', [6 6]) ;
neetu malik
neetu malik am 6 Aug. 2022
thank you so much sir

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

neetu malik
neetu malik am 3 Aug. 2022
tic
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=(c33*c55);
b=(c35^2);
d=(c15*c33);
e=(c13*c35);
f=(c33+c55);
g=(c15*c35);
j=(c11*c33);
m=(c13^2);
o=(c13*c55);
p=(c55+c11);
q=((c11*c55)-c15^2);
r=(c15+c35);
t=(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);
s2=root(2);
s3=root(3);
s4=root(4);
m1=-((c55)*(s1^2)-2*i*(c15)*(s1)+r1*(c^2)-(c11))/((c35)*(s1^2)-i*(c13+c55)*(s1)-(c15));
m2=-((c55)*(s2^2)-2*i*(c15)*(s2)+r1*(c^2)-(c11))/((c35)*(s2^2)-i*(c13+c55)*(s2)-(c15));
m3=-((c55)*(s3^2)-2*i*(c15)*(s3)+r1*(c^2)-(c11))/((c35)*(s3^2)-i*(c13+c55)*(s3)-(c15));
m4=-((c55)*(s4^2)-2*i*(c15)*(s4)+r1*(c^2)-(c11))/((c35)*(s4^2)-i*(c13+c55)*(s4)-(c15));
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);
p2=proot(2);
p3=proot(3);
p4=proot(4);
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*(c15)-m1*s1*(c35)+(i*m1-s1)*(c55);
K2=i*(c15)-m2*s2*(c35)+(i*m2-s2)*(c55);
K3=i*(c15)-m3*s3*(c35)+(i*m3-s3)*(c55);
K4=i*(c15)-m4*s4*(c35)+(i*m4-s4)*(c55);
K5=i*(c13)-m1*s1*(c33)+(i*m1-s1)*(c35);
K6=i*(c13)-m2*s2*(c33)+(i*m2-s2)*(c35);
K7=i*(c13)-m3*s3*(c33)+(i*m3-s3)*(c35);
K8=i*(c13)-m4*s4*(c33)+(i*m4-s4)*(c35);
e1=exp(k*s1*h);
e2=exp(k*s2*h);
e3=exp(k*s3*h);
e4=exp(k*s4*h);
A=[1 1 1 1 -1 -1; m1 m2 m3 m4 -n1 -n2; K1 K2 K3 K4 -n*u*(i*n1-p1) -n*u*(i*n2-p2); K5 K6 K7 K8 -n*(i*l-(l+2*u)*p1*n1) -n*(i*l-(l+2*u)*p2*n2); K1*e1 K2*e2 K3*e3 K4*e4 0 0; K5*e1 K6*e2 K7*e3 K8*e4 0 0];
AA =sym('AA',[6 6]);
detA=det(AA);
D=subs(detA, AA, A);
D1=solve(D==0,c)
toc
  2 Kommentare
neetu malik
neetu malik am 3 Aug. 2022
not working
Walter Roberson
Walter Roberson am 3 Aug. 2022
I am not sure I have that version of MATLAB installed on any accessible drive to test with.
Are you getting any error message?

Melden Sie sich an, um zu kommentieren.


neetu malik
neetu malik am 3 Aug. 2022
Error using plot
Vectors must be the same length.
Error in g3 (line 78)
plot(k,D2,'b')
this error is come
  3 Kommentare
neetu malik
neetu malik am 3 Aug. 2022
tic 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=(c33*c55); b=(c35^2); d=(c15*c33); e=(c13*c35); f=(c33+c55); g=(c15*c35); j=(c11*c33); m=(c13^2); o=(c13*c55); p=(c55+c11); q=((c11*c55)-c15^2); r=(c15+c35); t=(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); s2=root(2); s3=root(3); s4=root(4); m1=-((c55)*(s1^2)-2*i*(c15)*(s1)+r1*(c^2)-(c11))/((c35)*(s1^2)-i*(c13+c55)*(s1)-(c15)); m2=-((c55)*(s2^2)-2*i*(c15)*(s2)+r1*(c^2)-(c11))/((c35)*(s2^2)-i*(c13+c55)*(s2)-(c15)); m3=-((c55)*(s3^2)-2*i*(c15)*(s3)+r1*(c^2)-(c11))/((c35)*(s3^2)-i*(c13+c55)*(s3)-(c15)); m4=-((c55)*(s4^2)-2*i*(c15)*(s4)+r1*(c^2)-(c11))/((c35)*(s4^2)-i*(c13+c55)*(s4)-(c15)); 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); p2=proot(2); p3=proot(3); p4=proot(4); 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*(c15)-m1*s1*(c35)+(i*m1-s1)*(c55); K2=i*(c15)-m2*s2*(c35)+(i*m2-s2)*(c55); K3=i*(c15)-m3*s3*(c35)+(i*m3-s3)*(c55); K4=i*(c15)-m4*s4*(c35)+(i*m4-s4)*(c55); K5=i*(c13)-m1*s1*(c33)+(i*m1-s1)*(c35); K6=i*(c13)-m2*s2*(c33)+(i*m2-s2)*(c35); K7=i*(c13)-m3*s3*(c33)+(i*m3-s3)*(c35); K8=i*(c13)-m4*s4*(c33)+(i*m4-s4)*(c35); e1=exp(k*s1*h); e2=exp(k*s2*h); e3=exp(k*s3*h); e4=exp(k*s4*h); A=[1 1 1 1 -1 -1; m1 m2 m3 m4 -n1 -n2; K1 K2 K3 K4 -n*u*(i*n1-p1) -n*u*(i*n2-p2); K5 K6 K7 K8 -n*(i*l-(l+2*u)*p1*n1) -n*(i*l-(l+2*u)*p2*n2); K1*e1 K2*e2 K3*e3 K4*e4 0 0; K5*e1 K6*e2 K7*e3 K8*e4 0 0]; AA =sym('AA',[6 6]); detA=det(AA); D=subs(detA, AA, A); for h=2.4 k=4:0.2:5; D1=solve(D==0,c); D2=real(D1); plot(k,D2,'b') end hold on for h=2.6 k=4:0.2:5; D1=solve(D==0,c); D2=real(D1); plot(k,D2,'r') end hold on for h=2.8 k=4:0.2:5; D1=solve(D==0,c); D2=real(D1); plot(k,D2,'r') end hold off toc
Walter Roberson
Walter Roberson am 3 Aug. 2022
If you have the code
A = 1
D = A*5
A = 2
D
Then what value will D be afterwards? Will it be 0 or 1 or 2 or 5 or 10?
If you have the code
syms A
D = A*5
A = 2
D
Then what is the value of D afterwards? Why are you expecting D to have changed in this case when you did not expect D to change in the numeric case?

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by