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

3 Ansichten (letzte 30 Tage)
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)

Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by