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!