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 Center および File ExchangeInteractive 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