I want to find unknown value for nonlinear equation.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to find t1 value by search method with mesh grid plot between t1 and TC. Anyone help me to do this problem.
function tcfun()
clc
close all
t1=0:0.5:3;
TC=f(t1);
r0=[0.20;10];
alfa=0.2;
while abs (f(r0(1))) > 1e-2
r0 = r0 - alfa.*(f(r0(1)))./fprime(r0(1));
end
hold on
r0=[0.1]
alfa=0.2;
for index = 1:100
r0 = r0 - alfa.*inv(fdb1prime(r0(1)).*fprime(r0(1)));
end
r0
f(r0(1))
plot(r0(1),f(r0(1)),'rs','Markersize',20)
function TC = f(t1)
A0 =500;
D0=100;
c1=5;
c2=10;
c3=10;
c4=8;
a=30;
a2=40;
m=0.5;
b=5;
b2=7;
mu1=4;
mu2=8;
T=12;
k1=0.01;
k0=0.03;
TC=(1./T).*(A0+c1.*((b-a).*t1-(b.*t1^2./2)+(a+b.*(1+m)).*log((1+m-t1)./(1+m)))+c2.*((b.*t1^2./2)+(a+b.*(1+m)).*(t1+(1+m).*log(1+m-t1)))+c3.*((a./k1)-(b.*(1-k1.*T)./k1^2).*(mu1.*(log((1+k1.*(mu1-T))./(1+k1.*(t1-T)))-1)+t1)+((1-k1.*T)./k1).*(log((1+k1.*(mu1-T))./(1+k1.*(t1-T))))+(b.*k0./2.*k1).*(mu1-t1).^2+((a./k1)-(b.*k0.*(1-k1.*T)./k1^2).*(log((1+k1.*(mu1-T))./(1+k1.*(t1-T)))).*(mu2-mu1)+(k0.*D0./k1).*(mu2.*(log((1+k1.*(mu2-T))./(1+k1.*(t1-T)))-1)-mu1.*(log((1+k1.*(mu1-T))./(1+k1.*(t1-T)))-1)+((1-k1.*T)./k1).*(log((1+k1.*(mu2-T))./(1+k1.*(mu1-T))))+((a./k1)-(b.*k0.*(1-k1.*T)./k1^2).*(log((1+k1.*(mu1-T))./(1+k1.*(t1-T)))).*(T-mu2)+(b.*k0./k1).*(mu1-t1).*(T-mu2)+(k0.*D0./k1).*(log((1+k1.*(mu2-T))./(1+k1.*(mu1-T)))).*(T-mu2)-(k0.*b2./2.*k1).*(mu2-T).^2+((1./k1)-T)+(T-(1./k1)).*(T.*(log(1+k1(t1-T))-1)-mu2.*(log((1+k1.*(mu2-T))./(1+k1.*(t1-T)))-1))+(T-(1./k1)).*log(1+k1.*(mu2-T))))+c4.*(a.*(mu1-t1)+(b2./2).*(mu1.^2-t1.^2)-k0.*(a./k1)-(b.*(1-k1.*T)./k1^2).*(log((1+k1.*(mu1-T))./(1+k1.*(t1-T))))+(b./k1).*(mu1-t1))+D0.*(mu2-mu1)-(D0.*k0./k1).*(log((1+k1.*(mu2-T))./(1+k1.*(mu1-T))))+(1./2.*b2).*((a2-b2.*mu2).^2-(a2-b2.*T).^2)+k0.*a2.*log(1+k1.*(mu2-T))-(b2./k1).*(T-mu2)+(b2./k1).*(T-(1./k1)).*log(1+k1.*(mu2-T)))));
function TCprime = fprime(t1)
dfdt1=(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.*(1-k1.*T)./k1^2).*(((-mu1.*k1)./(1+k1.*(t1-T)))+1)-((1-k1.*T)./(1+k1.*(t1-T)))+((b.*k0.*(t1-mu1))./k1)-((a-b.*k0.*(1-k1.*T))./k1).*((mu2-mu1)./(1+k1.*(t1-T)))+(k0.*D0./k1).*((k1.*(mu1-mu2)./(1+k1.*(t1-T)))-(a-((b.*k0.*(1-k1.*T))./k1)).*((T-k2)./(1+k1.*(t1-T)))+(b.*k0.*(mu2-T)./k1)-(1-k1.*T).*((T+mu2)./(1+k1.*(t1-T)))))+c4.*(-a2+b2.*t1+k0.*((a-b.*(1-k1.*T))./k1).*(1./(1+k1.*(t1-T)))+(b./k1)));
end
end
end
mesh(t1,TC)
7 Commenti
Torsten
il 15 Mar 2022
I got the answer. But I need feasible solution. so , I want to apply optimization by using any one of search method.
But how can you be sure your method gives a feasible solution ?
As shown by the symbolic computation, there are three solutions for t1. Your Newton method will converge to any of them depending on the starting guess you choose for t1.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!