How do I get warning: Cannot solve symbolically. Returning a numeric approximation instead.
Mostrar comentarios más antiguos
I was trying to solve equations with solve. The code is attached.
sigmaf1=3.34;
ss=linspace(0,sigmaf1);
C0=20;
A=1227;
V0=1;
Vd=2/3;
Vc=1/3;
Cst=2;
Vt=0.0256;
Na=6.02*10^23;
q=1.6*10^-19;
xx=zeros(100,1);
yy=zeros(100,1);
zz=zeros(100,1);
vv=zeros(100,1);
for i=1:100;
syms x y z v
eq1=ss(i)*(10^18)*A*tanh(0.25*x/Vt)-Vd*(10^-3)*(C0-z)*Na;
eq2=2*y-ss(i)*(10^18)*q;
eq3=ss(i)*(10^18)-4*z*Na*v*(10^-9)*sinh(0.5*x/Vt);
eq4=v-0.30316./sqrt(1000.\z);
[X,Y,Z,V]=solve(eq1,eq2,eq3,eq4,x,y,z,v);
xx(i)=X; yy(i)=Y; zz(i)=Z; vv(i)=V;
end
the results shows that the value for xx has complex part. Can anyone help me avoid this problem? Thank you very much!
1 comentario
John D'Errico
el 11 de En. de 2017
Editada: John D'Errico
el 11 de En. de 2017
Please learn to use the "{} Code" button to format your code. I've fixed it once for you.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!