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

조회 수: 3 (최근 30일)
嘉杰 程
嘉杰 程 2021년 10월 19일
편집: 嘉杰 程 2021년 10월 19일
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)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by