Shooting method ode45 Fzero
Afficher commentaires plus anciens
I want to use the fzero function to approximate the value of t=1.65. However since the value of that point is about 501 and not zero, i am confused as how to code it. I am open to any solution as long as it uses the fzero function.
function shooting_method
x=1;
x1=fzero(@solver,x)
end
function F=solver(x)
% Parameters
L=3.6; %Length of stick
T0=315; % Temperature at x=0
TL=445; % temperature at x=L
options=odeset(RelTol=10^-6,AbsTol=10^-6);
[t,u]=ode45(@equation,[0 L],[T0 x],options);
s=length(t);
F=u(s,1)-TL;
figure(1)
plot(t,u(:,1))
end
function dy=equation(t,y)
L=3.6; %Length of stick
dy=zeros(2,1);
dy(1)=y(2);
dy(2)=((280*exp(-((t-L/2)^2))+y(2)/3)/(-(2+t/3)));
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
