필터 지우기
필터 지우기

How to solve this differential equation?

조회 수: 4 (최근 30일)
Mylu
Mylu 2015년 7월 4일
댓글: RahulTandon 2015년 7월 6일
I´m looking for dC/dx and C(x)
Parameters n, D, F, R, T, I, K are independet to x
How can I apply the one of the ode solvers to this problem with a given intial condition?
Thanks!

답변 (2개)

Star Strider
Star Strider 2015년 7월 4일
I may be missing something (if so I’ll defer to those with greater expertise if I am), the Symbolic Math Toolbox can do this easily. (You could probably do it almost as easily by hand, but then this is MATLAB Answers.)
It seems your first equation can be integrated to be a simple first-order differential equation, and although you use the partial derivative notation, both are actually ordinary differential equations. You could then substitute directly for diff(theta) in the first.
Using the Symbolic Math Toolbox, this is the code and result:
syms C(x) n D F R T I K Th(x) C0 Th0
Eq1 = diff(C,2) == diff(-n*D*(C)*F/(R*T)*diff(Th)); % First Eqn, Integrated w.r.t. ‘x’
Eq2 = diff(Th) == -R*T/(F*K*C) * ((1/F) + K*diff(C)); % Second Eqn
Eq3 = diff(C) == -n*D*(C)*F/(R*T)*(-R*T/(F*K*C) * ((1/F) + K*diff(C))); % Substitute Manually
C(x) = dsolve(Eq3, C(0) == C0)
C(x) =
C0 + (D*n*x)/(F*K - D*F*K*n)
Where C0=C(0).
Solving for Th(x):
Eq4 = diff(Th) == -R*T/(F*K*C(x)) * (1/F);
Th(x) = dsolve(Eq4, Th(0) == Th0)
Th(x) =
Th0 - (log(C0*F*K + D*n*x - C0*D*F*K*n)*(R*T - D*R*T*n))/(D*F*n) + (log(C0*F*K - C0*D*F*K*n)*(R*T - D*R*T*n))/(D*F*n)
Where Th0=Th(0).
You could easily create anonymous functions from these, or use matlabFunction to do it.
Note: I used R2015a to do this, but earlier versions should work.

RahulTandon
RahulTandon 2015년 7월 6일
syms x C theta n Dee F R T I K clear; clc; str1 = '-Dee*Dy - n*Dee*C*F/(R*T)*D2theta == 0'; %wrt x str2 = 'Dtheta+R*T/F(1/(K*C)*(1/F + K*y)) == 0 '; str3 = 'y == DC'; y = dsolve(str1,str2,str3,'x')

카테고리

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