how to convert struct to sym

54 views (last 30 days)
sunitha
sunitha on 21 Jan 2021
Edited: Walter Roberson on 28 Jan 2021
i am solving non linear equations using excel data . but i am getting the error is unable to convert struct to syms can anyone help me ??
syms 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=24345;
k=1.076;
Kn=0.27
kd=0.04
bs=0.15
Xf=0.49
Df=1.04
Dw=1.3
L=0.04
a=2.24
Y=0.39;
bt=kd+bs
Nstar=N/Kn;
Nmin=Kn/((Y*k/bt)-1);
Lstar=L*(sqrt(k*Xf/Kn*Df))*Df*Dw;
Nstar_min=(1/(Y*k*(bt-1)));
jstar=(J/sqrt(Kn*k*Xf*Df));
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))),(sqrt((Lstar^1.76)+5.2*(Nstar-Nstar_min))-(Lstar^0.88))/2.6==jstar^0.88,N,J)
vpa(solutions{S})
end
celldisp(solutions)

Accepted Answer

Walter Roberson
Walter Roberson on 25 Jan 2021
Edited: Walter Roberson on 28 Jan 2021
for S=1:nX
solutions{S}=solve(Qo(S)*(1+R(S))*(No(S)-N)-V*(a*J+((X(S)*k*N)/(Kn+N))),(sqrt((Lstar^1.76)+5.2*(Nstar-Nstar_min))-(Lstar^0.88))/2.6==jstar^0.88,N,J);
temp = struct2cell(solutions{S});
vpa(horzcat(temp{:}))
end
This will use one column for each variable, but in the general case you will have difficulty figuring out exactly what order the variables will appear in -- and this makes no aattempt to label them on output.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!