How do I get warning: Cannot solve symbolically. Returning a numeric approximation instead.
显示 更早的评论
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 个评论
John D'Errico
2017-1-11
编辑:John D'Errico
2017-1-11
Please learn to use the "{} Code" button to format your code. I've fixed it once for you.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!