solve non linear equations
1 view (last 30 days)
Show older comments
i wrote the code for non linear equations. But i got the error .can u please tell me how to rectify this error
lear all
close all
syms S J
Qo=26560 %%m3/day
R=0.56
So=220
V=2434.67 %%
X=3000
Ks=0.27
k=1.076
Y=0.39
kd=0.04
bs=0.15
Xf=0.49
Df=1.04
Dw=1.3
L=0.04
a=2.24
bt=kd+bs
Smin=Ks/((Y*k/bt)-1)
Lstar=L*(sqrt(k*Xf/Ks*Df))*Df*Dw
Sstar=S/Ks
jstar=(J/sqrt(Ks*k*Xf*Df))
Sstar_min=(1/(Y*k*(bt-1)))
r=(So-S)/So
eqn1=Qo*(1+R)*(1-r)*(So-S)-a*V*J==0;
eqn2=sqrt((Lstar^1.76)+5.2*(Sstar-Sstar_min)-(Lstar^0.88))/2.6==jstar^0.88;
0 Comments
Answers (2)
Alan Stevens
on 15 Jan 2021
Add these lines at the end to get the values of S and J
Soln = vpasolve([eqn1, eqn2],[S, J],[1 1]);
disp(Soln.S)
disp(Soln.J)
4 Comments
Alan Stevens
on 16 Jan 2021
Well, the following gets results and writes to an Excel spreadsheet
syms N
Qo=26560;
R=0.56;
No=xlsread('suspended','Sheet1','C2:C5');
X=xlsread('suspended','Sheet1','F2:F5');
r=(No-N)/No;
V=2435;
k=1.076;
Kn=0.27;
nX=size(X,1);
solutions=cell(nX,1);
Nres = zeros(3,nX);
for S=1:nX
solutions{S}=solve(Qo.*(1+R).*(No(S)-N)*r(S)-V*((X(S)*k*N)/(Kn+N)),N);
Nres(:,S) = vpa(solutions{S});
end
fname = 'suspendedresults.xlsx';
xlswrite(fname,Nres)
However, I've no idea what your code is all about, so can't comment on the validity of the result.
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!