how to convert struct to sym

조회 수: 47 (최근 30일)
sunitha
sunitha 2021년 1월 21일
편집: Walter Roberson 2021년 1월 28일
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)

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 25일
편집: Walter Roberson 2021년 1월 28일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by