フィルターのクリア

how to solve one variable in non linear equation?

5 ビュー (過去 30 日間)
M.Rameswari Sudha
M.Rameswari Sudha 2023 年 1 月 12 日
コメント済み: M.Rameswari Sudha 2023 年 1 月 12 日
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)

採用された回答

Torsten
Torsten 2023 年 1 月 12 日
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])
t1 = 
0.4999993236378365887378927054944
double(subs(h,t1))
ans = 2.2769e-24
  1 件のコメント
M.Rameswari Sudha
M.Rameswari Sudha 2023 年 1 月 12 日
Thank you so much. I got the answer.

サインインしてコメントする。

その他の回答 (1 件)

VBBV
VBBV 2023 年 1 月 12 日
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])
Equation solved, solver stalled. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared and the vector of function values is near zero as measured by the value of the function tolerance.
t1 = 1×2
10.4643 10.4643
disp(t1)
10.4643 10.4643
  4 件のコメント
M.Rameswari Sudha
M.Rameswari Sudha 2023 年 1 月 12 日
I want to solve t1 from h. No need to find h value. Help me
VBBV
VBBV 2023 年 1 月 12 日
Read about fsolve for more info. Try with different initial values. I have shown an e.g.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumbers and Precision についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by