empty sym 0-by-1 error

13 vues (au cours des 30 derniers jours)
Maya Venugopalan
Maya Venugopalan le 7 Oct 2020
syms c
delta = 0.0158;
alp = 6;
a = alp*delta;
Re = 1000;
y = 0.5;
y1 = y*delta;
U = (-357554.879*y1^2 + 11298.734*y1)/89.26;
ddU = -2;
l3 = -((-((a*Re*c*1i)-(2*a^2)-(a*Re*U*1i))+((2*a^2*Re^2*U*c)-(a^2*Re^2*(U^2+c^2))-(4*a*Re*ddU*1i))^(1/2))/2)^(1/2);
l4 = -((-((a*Re*c*1i)-(2*a^2)-(a*Re*U*1i))-((2*a^2*Re^2*U*c)-(a^2*Re^2*(U^2+c^2))-(4*a*Re*ddU*1i))^(1/2))/2)^(1/2);
eqn = subs((U-c)*((l3^2*exp(l3*y) - l4^2*exp(l4*y)) - (a^2*(exp(l3*y)-exp(l4*y))))-(ddU*(exp(l3*y)-exp(l4*y)))-((1/(a*Re*1i))*(((l3^4*exp(l3*y))-(l4^4*exp(l4*y)))-(2*a^2*(l3^2*exp(l3*y) - l4^2*exp(l4*y))) + a^4*(exp(l3*y)-exp(l4*y)))));
answer = vpasolve(eqn,c)
In this particular code, for alp = 6,8,12,13,, the output is an error, "empty sym 0-by-1". But for alp values like 1,2,3,4,5,7,..I am getting values of c. I actualy want all the values of c when alp varies from 1 to 20
Can somebody help me with the solution?
Thank you!!
  4 commentaires
Walter Roberson
Walter Roberson le 7 Oct 2020
syms c
delta = 0.0158;
alp = 6;
a = alp*delta;
Re = 1000;
y = 0.5;
y1 = y*delta;
U = (-357554.879*y1^2 + 11298.734*y1)/89.26;
ddU = -2;
l3 = -((-((a*Re*c*1i)-(2*a^2)-(a*Re*U*1i))+((2*a^2*Re^2*U*c)-(a^2*Re^2*(U^2+c^2))-(4*a*Re*ddU*1i))^(1/2))/2)^(1/2);
l4 = -((-((a*Re*c*1i)-(2*a^2)-(a*Re*U*1i))-((2*a^2*Re^2*U*c)-(a^2*Re^2*(U^2+c^2))-(4*a*Re*ddU*1i))^(1/2))/2)^(1/2);
eqn = subs((U-c)*((l3^2*exp(l3*y) - l4^2*exp(l4*y)) - (a^2*(exp(l3*y)-exp(l4*y))))-(ddU*(exp(l3*y)-exp(l4*y)))-((1/(a*Re*1i))*(((l3^4*exp(l3*y))-(l4^4*exp(l4*y)))-(2*a^2*(l3^2*exp(l3*y) - l4^2*exp(l4*y))) + a^4*(exp(l3*y)-exp(l4*y)))));
answer = vpasolve(simplify(eqn),c)
answer = 
0.808659088500827642279535174149560.012297044380461873020713794371614i
Which release are you using? It works in R2020a and R2020b
Maya Venugopalan
Maya Venugopalan le 7 Oct 2020
Yes!! This worked!!!
I'm using R2019a.
Thank you soooo much!!!!

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 7 Oct 2020
Modifié(e) : Walter Roberson le 7 Oct 2020
syms c
delta = 0.0158;
alp = 6;
a = alp*delta;
Re = 1000;
y = 0.5;
y1 = y*delta;
U = (-357554.879*y1^2 + 11298.734*y1)/89.26;
ddU = -2;
l3 = -((-((a*Re*c*1i)-(2*a^2)-(a*Re*U*1i))+((2*a^2*Re^2*U*c)-(a^2*Re^2*(U^2+c^2))-(4*a*Re*ddU*1i))^(1/2))/2)^(1/2);
l4 = -((-((a*Re*c*1i)-(2*a^2)-(a*Re*U*1i))-((2*a^2*Re^2*U*c)-(a^2*Re^2*(U^2+c^2))-(4*a*Re*ddU*1i))^(1/2))/2)^(1/2);
eqn = subs((U-c)*((l3^2*exp(l3*y) - l4^2*exp(l4*y)) - (a^2*(exp(l3*y)-exp(l4*y))))-(ddU*(exp(l3*y)-exp(l4*y)))-((1/(a*Re*1i))*(((l3^4*exp(l3*y))-(l4^4*exp(l4*y)))-(2*a^2*(l3^2*exp(l3*y) - l4^2*exp(l4*y))) + a^4*(exp(l3*y)-exp(l4*y)))));
answer = vpasolve(simplify(eqn),c)
Note: my research suggested that there might be up to three solutions, with the real and imaginary parts all within +/- 2 . It was difficult to tell whether some of the locations reached zero or just came close to zero.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by