Solving the Ordinary Differential Equation
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I am not sure how to solve these systems of differential equation. However, the final graph representation of the result is two exponential curves for
and
in respect to time.
Also, with
=
, the variable ks and BP are all constant.
採用された回答
madhan ravi
2018 年 11 月 15 日
編集済み: madhan ravi
2018 年 11 月 15 日
EDITED
use dsolve()
or
Alternate method using ode45:

tspan=[0 1];
y0=[0;0];
[t,x]=ode45(@myod,tspan,y0)
plot(t,x)
lgd=legend('Cp(t)','Cr(t)')
lgd.FontSize=20
function dxdt=myod(t,x)
tau=2;
ks=3;
BP=6;
k1=5;
k2=7;
x(1)=exp(-t)/tau; %x(1)->Cp
dxdt=zeros(2,1);
dxdt(1)=k1*x(1)-(k2/(1+BP))*x(2); %x(2)->Cr
dxdt(2)=k1*x(1)-k2*x(2);
end
9 件のコメント
Yeahh
2018 年 11 月 15 日
So should I set these two equations as two functions and then set some values to the variables? And ended with dsolve()?
madhan ravi
2018 年 11 月 15 日
編集済み: madhan ravi
2018 年 11 月 15 日
yes declare them by using syms Ct(t) Cr(t)
and then solve them
and use fplot(Ct(t)) to plot the curve
Yeahh
2018 年 11 月 15 日
What should I do with the constant variables?
madhan ravi
2018 年 11 月 15 日
Substitute some numbers there
Yeahh
2018 年 11 月 15 日
I got something like this, but when I have the t defined, it is not running and I also need to know how to display the results as a plot
syms C_T(t) C_r(t);
t=[1:10000];
equations=[diff(C_T,t)==(3*exp(-t)-(3/(1+2))*C_T), diff(C_r,t)==(3*exp(-t)-3*C_r)];
sol=dsolve(equations);
Yeahh
2018 年 11 月 15 日
編集済み: madhan ravi
2018 年 11 月 15 日
But the first differential equation is dcT/dt not Cp(t), is that the same?
madhan ravi's reply : no they are not the same
madhan ravi
2018 年 11 月 15 日
dcT/dt refers to dxdt(1)
Yeahh
2018 年 11 月 15 日
編集済み: madhan ravi
2018 年 11 月 15 日
Thank you so much, I have one last question.
What doest this line means?
dxdt=zeros(2,1);
madhan ravi
2018 年 11 月 15 日
編集済み: madhan ravi
2018 年 11 月 15 日
Anytime :), It is called preallocation(please google it) imagine as a container to store something. Make sure to accept for the answer if it was helpful.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
