필터 지우기
필터 지우기

How to get the plot from ODE

조회 수: 2 (최근 30일)
Kartik Lanjewar
Kartik Lanjewar 2024년 1월 15일
댓글: Kartik Lanjewar 2024년 1월 15일
Hello there, I got stuck with the plots which are drawn in the result. How to solve the ODE's to get the required plots for dimensionless number mentioned in the paper, please let me know if anyone can get it ?

채택된 답변

Sam Chak
Sam Chak 2024년 1월 15일
There are over 50 equations in the PDF, and the ODEs appear in various places. Most forum users don't have the time to read the entire paper and identify which set of ODEs to solve, especially users who are not experts in the film-boiling chemical vapor infiltration process.
You can find examples in the ode45 documentation and follow them to write the MATLAB code for your application. Afterward, post the code so that we can troubleshoot any errors that may arise.
I used the first example here, the popular Van der Pol oscillator in the Electrical Engineering world. They are just a few lines. But the length of the ODE function (odefun) depends on the size of the system that you want to solve.
%% Use ode45 to solve ODEs on time span [0 20] with initial values [2 0]
[t, y] = ode45(@odefun, [0 20], [2; 0]);
%% Plot the results
plot(t, y(:,1), '-o', t, y(:,2), '-o')
%% Labels
title('Solution of van der Pol Equation (\mu = 1) with ODE45');
xlabel('Time t'), ylabel('Solution y'), legend('y_1', 'y_2')
%% ODEs of Van der Pol oscillator
function dydt = odefun(t,y)
dydt = [y(2);
(1 - y(1)^2)*y(2) - y(1)];
end
  댓글 수: 3
Sam Chak
Sam Chak 2024년 1월 15일
@Kartik Lanjewar, I can show you a code snippet, but I'm not an expert in film-boiling infiltration dynamics. So, you need to learn how to define the coefficients or parameters in the dynamics.
%% Use ode45 to solve ODEs
[x, y] = ode45(@odefun, [0 1], [0; 1; 0.5]);
%% Plot the results
plot(x, y), grid on
xlabel('\xi')
%% film-boiling infiltration dynamics
function dydx = odefun(x, y)
% Definitions
theta = y(1);
psi = y(2);
epsil = y(3);
% Parameters (define it yourself)
H = 1;
m = 1;
omega = 1;
Phi = 1;
n = 1;
B = 1;
f = 1;
% ODEs
dydx = [- 1/(1 - epsil);
H*epsil^(-(m + 1)) + omega*(Phi^2)*epsil^(-m)
(1/omega)*epsil^(1/n)*(1 - B*epsil)*f*psi];
end
Kartik Lanjewar
Kartik Lanjewar 2024년 1월 15일
thanks for the help, i will try accordingly.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

AMIT SURYAVANSHI
AMIT SURYAVANSHI 2024년 1월 15일
% Define the ODE function
odeFunc = @(t, y) -2 * y;
% Define the time span
tspan = [0 5];
% Specify the initial condition
y0 = 1;
% Solve the ODE using ode45
[t, y] = ode45(odeFunc, tspan, y0);
% Plot the solution
plot(t, y);
xlabel('Time');
ylabel('Solution');
title('ODE Solution');
% Display the plot
grid on;
  댓글 수: 1
AMIT SURYAVANSHI
AMIT SURYAVANSHI 2024년 1월 15일
In the example above i have used the ode dy/dt=-2y and the begining condition is y(0)=1 it's a basic code but it may help you out their

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by