solving system of equations

1 次查看(过去 30 天)
sunitha
sunitha 2021-1-25
Hii, i am solving the system of the equations using excel data. I wrote the code for the system of the equations.but the problem is i am not getting the result here can anyone help me to solve yms N J
Qo=xlsread('suspended.xlsx','A:A')
R=xlsread('suspended.xlsx','B:B')
No=xlsread('suspended.xlsx','C:C')
X=xlsread('suspended.xlsx','D:D')
V = 2435 ;
k = 1.076 ;
Kn = 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
Nstar=N/Kn;
Nmin=Kn/((Y*k/bt)-1)
Lstar=L*(sqrt(k*Xf/Kn*Df))*Df*Dw;
jstar=(J/sqrt(Kn*k*Xf*Df));
Nstar_min=(1/(Y*k*(bt-1)));
nX = size(X,1 );
solutions = cell(1, nX);
for S=1:nX
solutions{S}=solve(Qo(S)*(1+R(S))*(No(S)-N)-V*(a* J+((X(S)*k*N)/(Kn+N))),N,J)
end
eqn1=sqrt((Lstar^1.76)+5.2*(Nstar-Nstar_min)-(Lstar^0.88))/2.6==jstar^0.88;
soln=vpasolve([eqn1],[N,J]);
celldisp(solutions)

回答(1 个)

Star Strider
Star Strider 2021-1-25
This runs without error (after several changes):
V = 2435 ;
k = 1.076 ;
Kn = 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;
Nstar=@(N)N/Kn;
Nmin=Kn/((Y*k/bt)-1);
Lstar=L*(sqrt(k*Xf/Kn*Df))*Df*Dw;
jstar=@(J)(J/sqrt(Kn*k*Xf*Df));
Nstar_min=(1/(Y*k*(bt-1)));
nX = size(X,1 );
% solutions = cell(1, nX);
solutions = zeros(2,4);
for S=1:nX
solutions(:,S)=fsolve(@(b) Qo(S)*(1+R(S))*(No(S)-b(2))-V*(a* b(1)+((X(S)*k*b(2))/(Kn+b(2)))), rand(2,1)); % b(1) = J, b(2) = N
end
eqn1=@(b) sqrt((Lstar^1.76)+5.2*(Nstar(b(2))-Nstar_min)-(Lstar^0.88))/2.6 - jstar(b(1)).^0.88;
soln=fsolve(eqn1,rand(2,1));
It is not possible to mix symbolic functions with non-symbolic expressions. I use Optimization Toolbox functions here instead of Symbolic Math Toolbox functions.
I leave it to you to interpret the results, since I have no idea what problem the code solves.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by