Find relation of initial value and maximum of the value by solving this odes

3 vues (au cours des 30 derniers jours)
嘉杰 程
嘉杰 程 le 19 Oct 2021
Modifié(e) : 嘉杰 程 le 19 Oct 2021
by solving this ode, we could get the relation plot of r and m (assuming =2,=0),
now I want to change the value of (between 0-4) to get maximum of munder each , and I also want to plot , could anyone help me? thank you!
basic code between m-r like this:
fun2.m
function dtm=func2(r,tm)
dtm=zeros(2,1);
dtm(1)=(-4)*(sinh(tm(1))-2*sinh(tm(1)/2))*(r^3*(sinh(tm(1)) ...
-8*sinh(tm(1)/2)+3*tm(1))+tm(2))/((3*tm(1))*(tm(1)-2*tm(2))* ...
(cosh(tm(1))-4*sinh(tm(1)/2)+3));
dtm(2)=(r^2)*(sinh(tm(1))-tm(1));
and here is the main.m
rspan=[0 20];
y0=[2;0];
[r,y]=ode45(@func2,rspan,y0);
subplot(1,2,1)
plot(r,y(:,2),'b-');
M=max(y(:,2));
grid on;
title('m-r');
axis([0 4 0 2])
xlabel('r'); ylabel('m');
legend('y_1','y_2')
subplot(1,2,2)

Réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by