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!