how to solve one variable in non linear equation?
5 views (last 30 days)
Show older comments
M.Rameswari Sudha
on 12 Jan 2023
Commented: M.Rameswari Sudha
on 12 Jan 2023
In my coding I couldn't get the value for t1. I get the answer in cubic equation of another variable z. But I didn't use z anywhere in my codind. Anyone help and tell how to get the answer for t1.
clc
clear all
T=12; u1=4;u2=8;a=30;b=5;a2=100;A=500;c2=10;c3=12;c4=8;D0=115; b2=0.2;
a=0.01;d=0.2;m=0.5;k1=0.5;k0=1;k2=2;
syms t1
c1=5;
h=(1./T).*(c1.*((b-a)-b.*t1-(a+b.*(1+m)./(1+m-t1)))+c2.*(b.*t1-(a+b.*(1+m)).*(t1./(1+m-t1)))+c3.*((a./k1)-((b./k1.^2).*(1-k1.*T)).*(((-u1.*k1)./(1+k1.*(t1-T))+1)-((1-k1.*T)./(1+k1.*(t1-T)))+(b.*k0.*(t1-u1)./k1)-(a-(b.*k0.*(1-k1.*T)./k1)).*((u2-u1)./(1+k1.*(t1-T)))+(k0.*D0./k1).*((k1.*(u1-u2)./(1+k1.*(t1-T)))-(a-(b.*k0./k1).*(1-k1.*T)).*((T-k2)./(1+k1.*(t1-T)))+(b.*k0./k1).*(u2-T)-(1-k1.*T).*((T+u2)./(1+k1.*(t1-T)))+c4.*(-a2+b2.*t1+k0.*(a-(b./k1).*(1-k1.*T).*(1./(1+k1.*(t1-T))+(b./k1))))))));
t1=solve(h)
disp(t1)
0 Comments
Accepted Answer
Torsten
on 12 Jan 2023
T=12; u1=400;u2=8;a=30;b=5;a2=100;A=500;c2=10;c3=12;c4=8;D0=115; b2=0.2;
a=-1.1;d=11.2;m=-0.5;k1=1.5;k0=1.1;k2=2;
syms t1
c1=5;
h= (1./T).*(c1.*((b-a)-b.*t1-(a+b.*(1+m)./(1+m-t1)))+c2.*(b.*t1-(a+b.*(1+m)).*(t1./(1+m-t1)))+c3.*((a./k1)-((b./k1.^2).*(1-k1.*T)).*(((-u1.*k1)./(1+k1.*(t1-T))+1)-((1-k1.*T)./(1+k1.*(t1-T)))+(b.*k0.*(t1-u1)./k1)-(a-(b.*k0.*(1-k1.*T)./k1)).*((u2-u1)./(1+k1.*(t1-T)))+(k0.*D0./k1).*((k1.*(u1-u2)./(1+k1.*(t1-T)))-(a-(b.*k0./k1).*(1-k1.*T)).*((T-k2)./(1+k1.*(t1-T)))+(b.*k0./k1).*(u2-T)-(1-k1.*T).*((T+u2)./(1+k1.*(t1-T)))+c4.*(-a2+b2.*t1+k0.*(a-(b./k1).*(1-k1.*T).*(1./(1+k1.*(t1-T))+(b./k1))))))));
t1=vpasolve(h,t1,[0 1])
double(subs(h,t1))
More Answers (1)
VBBV
on 12 Jan 2023
clc
clear all
T=12; u1=400;u2=8;a=30;b=5;a2=100;A=500;c2=10;c3=12;c4=8;D0=115; b2=0.2;
a=-1.1;d=11.2;m=-0.5;k1=1.5;k0=1.1;k2=2;
syms t1
c1=5;
h=@(t1) (1./T).*(c1.*((b-a)-b.*t1-(a+b.*(1+m)./(1+m-t1)))+c2.*(b.*t1-(a+b.*(1+m)).*(t1./(1+m-t1)))+c3.*((a./k1)-((b./k1.^2).*(1-k1.*T)).*(((-u1.*k1)./(1+k1.*(t1-T))+1)-((1-k1.*T)./(1+k1.*(t1-T)))+(b.*k0.*(t1-u1)./k1)-(a-(b.*k0.*(1-k1.*T)./k1)).*((u2-u1)./(1+k1.*(t1-T)))+(k0.*D0./k1).*((k1.*(u1-u2)./(1+k1.*(t1-T)))-(a-(b.*k0./k1).*(1-k1.*T)).*((T-k2)./(1+k1.*(t1-T)))+(b.*k0./k1).*(u2-T)-(1-k1.*T).*((T+u2)./(1+k1.*(t1-T)))+c4.*(-a2+b2.*t1+k0.*(a-(b./k1).*(1-k1.*T).*(1./(1+k1.*(t1-T))+(b./k1))))))));
t1=fsolve(h,[0 1])
disp(t1)
4 Comments
VBBV
on 12 Jan 2023
Read about fsolve for more info. Try with different initial values. I have shown an e.g.
See Also
Categories
Find more on Numbers and Precision 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!