How to integrate this function using ode23?

1 回表示 (過去 30 日間)
Anshuman S
Anshuman S 2020 年 3 月 14 日
コメント済み: Ameer Hamza 2020 年 3 月 14 日
The given function is as follows:
I've written the following code:
clc
clear all
tspan = [0 10];
y0 = 0;
%[t,y] = ode23(@(t,y) 2*t, tspan, y0);
Minc = 67;
Mp = 12;
dfe = 7200;
din = 4040;
Dp = 5e-5;
Cl = 0.045;
Cleq = 0.005;
z = (Minc/(100*Mp))*(dfe/din)*Dp*(Cl - Cleq) ;
disp( z)
[t,y] = ode23(@(t,y) (1/y)*(Minc/(100*Mp))*(dfe/din)*Dp*(Cl - Cleq), tspan, y0);
plot(t,y,'-o');
  8 件のコメント
Anshuman S
Anshuman S 2020 年 3 月 14 日
But why tspan = [0.5 10], why not start from 0
tspan = [0 10]
Ameer Hamza
Ameer Hamza 2020 年 3 月 14 日
I was trying different values and this is the one I pasted here. This following one works too
tspan = [1e-308 10];

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 3 月 14 日
Although I couldn't figure out the actual cause of this issue, the error is caused by setting the initial condition to zero. It can be resolved by giving a tiny value to the initial condition. For example,
y0 = 1e-308; % minimum possible exponent for double

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by