empty sym 0-by-1 error

조회 수: 11 (최근 30일)
Maya Venugopalan
Maya Venugopalan 2020년 10월 7일
편집: Walter Roberson 2020년 10월 7일
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
Walter Roberson
Walter Roberson 2020년 10월 7일
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 2020년 10월 7일
Yes!! This worked!!!
I'm using R2019a.
Thank you soooo much!!!!

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 7일
편집: Walter Roberson 2020년 10월 7일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by