Need help with bisection of this function, any advise or help would be great! thanks in advance to all!

2 次查看(过去 30 天)
this is the code I used for the first part of the question and is correct:
h=0.1;
t=36;
N=(t/h);
t=zeros(1,N+1);
p=zeros(1,N+1);
t(1)=0;
p(1)=87;
for n=1:N
t(n+1)=t(n)+h;
u=sin((2*pi*t)/12);
H=15*[nthroot(u,15)+1]
p1(n+1)=p(n)+h*[(0.016*p(n)*(100-p(n)))-H(n)];
p(n+1)=p(n)+(h/2)*[[(0.016*p(n)*(100-p(n)))-H(n)]+[(0.016*p(n+1)*(100-p(n+1)))-H(n+1)]];
end
What I need to find now is the largest value of H for which the solution for P(t) does not be 0 at t = 36.
I know some of the code :
H=@(t)15*[nthroot(u,15)+1];
upper-limit=100;
lower-limit=1;
mid-point=(upper-limit+lower-limit)/2;
while lower-limit-upper-limit>0
if (?)*(?)<0
upper-limit=mid-point;
else
lower-limit=mid-point;
end
end
if anyone knows how to fill this parts of my code it would be a huge help!! just confused about how to account for H changing and P at the sametime!!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 NaNs 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by