Solving 3 simultaneous equations using solve.

3 views (last 30 days)
Good day,
I am struggling to use the solve function in order to solve for L, Rs, and Rb. My code does not produce any results, or errors. Please find my code below. I would appreciate any advice.
Thanks in advance!
Karien
%define attributes:
gamma=21.05;
phi=35.55;
phi1=0.75*phi;
d=0.6;
syms L Rs Rb;
zc=(0.3*phi1-3.5)*d;
Ab=0.2827; %'pi'*(d*d)/4;
As1=5.08796;%'pi'*d*zc;
As2='pi'*d*(L-zc);
Nq=exp('pi'*tan(phi))*(tan(phi/2 +45))^2;
svb=gamma*L;
svs=gamma*zc;
G=1200;
Q=600;
eq1= Rs/1.4 + Rb/1.7 == 1.0*G +1.3*Q;
eq2= Rs == svs*tan(phi)*(1-sin(phi))*(0.5*As1+As2);
eq3= Rb == svb*Ab*Nq;
sol= solve([eq1,eq2,eq3],[L,Rs,Rb]);
Lsol=sol.L;
Rssol=sol.Rs;
Rbsol=sol.Rb;

Answers (1)

Wan Ji
Wan Ji on 2 Sep 2021
Do not use 'pi' use pi instead
%define attributes:
gamma=21.05;
phi=35.55;
phi1=0.75*phi;
d=0.6;
syms L Rs Rb;
zc=(0.3*phi1-3.5)*d;
Ab=0.2827; %'pi'*(d*d)/4;
As1=5.08796;%'pi'*d*zc;
As2=pi*d*(L-zc);
Nq=exp(pi*tan(phi))*(tan(phi/2 +45))^2;
svb=gamma*L;
svs=gamma*zc;
G=1200;
Q=600;
eq1= Rs/1.4 + Rb/1.7 == 1.0*G +1.3*Q;
eq2= Rs == svs*tan(phi)*(1-sin(phi))*(0.5*As1+As2);
eq3= Rb == svb*Ab*Nq;
sol= solve([eq1,eq2,eq3],[L,Rs,Rb])
Lsol=sol.L
Rssol=sol.Rs
Rbsol=sol.Rb
Result is
Lsol =
(255*(4275354068281784437756792116609024*pi + 39038561809674979475803485110635625))/(274877906944*(1469363753180227599360000*pi + 29915351642033550057827))
Rssol =
(433291241555137581*(464595761707792941092070619575922905317376*pi + 1390999186121382415192427995471416716875))/(49517601571415210995964968960000*(1469363753180227599360000*pi + 29915351642033550057827))
Rbsol =
(217954704820530150421311*(4275354068281784437756792116609024*pi + 39038561809674979475803485110635625))/(99035203142830421991929937920000*(1469363753180227599360000*pi + 29915351642033550057827))
My matlab version 2020a

Categories

Find more on Function Creation in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!