본문으로 건너뛰기
Hub Nexus
업데이트됨

작성자아직 작성자가 없습니다맡기

개선할 점이 보이나요? 변경을 제안하세요.

후원

이 페이지는 공개 상태입니다.

Order of Differential Equations

A differential equation is an equation with a function and one or more of its derivatives. It is usually to describe changes.

Note: Derivatives = \frac{d y}{d x} .

An order of differential equation (ODE) is an equation that has highest derivative of the dependent variable involved some ordinary derivatives of a function with respect to the independent variable. Often, the goal is to solve an ODE, i.e., determine what function or functions satisfy the equation. That means the differential equation defines the relationship between variables and their derivatives.

There are a primarily two of ODE types

  • 1st Order Differential Equation (1st ODE)
  • 2nd Order Differential Equation (2nd ODE)

First Order Differential Equation

All the linear equations in the form of derivatives are in the first order. It has only the first derivative such as dy/dx, where x and y are the two variables and is represented as

\frac{d y}{d x} + P y = Q

Second-Order Differential Equation

When the order of the highest derivative present is 2, then it is a second order differential equation.

\frac{{d}^{2} y}{d {x}^{2}} + n \frac{d y}{d x} + m {y}^{2} = P

Using dsolve solve differential equation

We have an differential equations as follow,

\frac{d {y}^{3}}{d {x}^{3}} + 2 \frac{d {y}^{2}}{d {x}^{2}} + 5 \frac{d y}{d x} + 4 y = 5 x , y ( 0 ) = 1 , {y}^{′} ( 0 ) = 3

In order to solve this differential equation in MATLAB , we uses dsolve command to get the answer as followed

>>s=dsolve('D3y+2D2y+5Dy+4y=5x','y(0)=1','Dy(0)=3')

s =

(5x)/4 - exp(-t)(15^(1/2)C1 - (5x)/4 + 7) + exp(-t/2)cos((15^(1/2)t)/2)(15^(1/2)C1 - (5x)/2 + 8) - C1exp(-t/2)*sin((15^(1/2)*t)/2)

Type of ODE solver in MATLAB

There are few types of ODE solver but we will focus on just the commonly used :

ODEAccuracyUse case suggestion
ode45MediumFor most use case, ode45 should be enough to solve the ODE
ode23Lowode23 can be more efficient than ode45 at problems with crude tolerances
ode113Low to Highode113 can be more efficient than ode45 at problems with stringent error tolerances, or when the ODE function is computationally intensive.

Examples: ODE45 to solve differential equations

There are $10,000 deposited into the bank fixed deposit accounts and the interest rate is 2% annually.

To start with, we need to do a equation to model the money.

Equation 1: \frac{d M}{d t} = \frac{2}{100} M  : Annual saving interest is 2% annually on the balance of the bank balance over time ,

Equation 2: M ( 0 ) = 10 , 000 : Amount of money initial is at $10,000

From Equation 1, we take out (Note: Need to consult on other Wikiprojects on how to derive the linear equations)

d M = 0.002 M . d t

{∫}_{}^{} \frac{1}{M} . d M = {∫}_{}^{} 0.02 d t

ln ⁡ e M = ln ⁡ e ( 0.02 t ) + c

M ( t ) = {e}^{0.02 t} . {e}^{c} , where {e}^{c} = {M}_{( 0 )}

M ( t ) = {e}^{0.02 t} . {M}_{( 0 )} , taken from equation 2

M ( t ) = 10000. {e}^{0.02 t}

Using dsolve functions , we can similarly convert the differential equations

>> syms M(t) p
>> eqn = diff(M,t) == 0.02*M;
>> S= dsolve(eqn,M(0)==10000)

S =
10000*exp(t/50)

Hence. we have equations (shown as S) to do our modelling.

In MALAB to calculate differential equations using ode45 , the syntax is as followed

[t,y] = ode45(odefun,tspan,y0)

where,

t = Evaluation points, returned as a column vector

y = Solutions, returned as an array

odefun = Function of the ode. You may use anonymous functions instead of writing a new files for the functions

tspan = Interval of integration, specified as a vector. At minimum, tspan must be a two element vector [t0 tf] specifying the initial and final times

y0 = Initial conditions, specified as a vector. y0 must be the same length as the vector output of ode function,

Using dsolve for converted differential equations ode45 functions to solve ODE

function [T,M] = money_in_bank(R)

% Enter the initial values for the amount of money in the bank
M0 = 1000;

% Enter the interest rate
R = 2;

% Enter the time period
T0 = 1;
Tf = 30;

% using dsolve previously
S=10000*exp(T0/50)

% Solve the differential equation
[T, M] = ode45(@(T,M)S, [T0, Tf], M0);

% Plot the solution
plot(T,M,'-o')

% Add a legend and labels
legend('M(t)')
xlabel('Years')
ylabel('Money in Bank')

References

web.archive.org/web/20220201162959/https://byjus.com/maths/differential-equation-and-its-degreeweb.archive.org/web/20220822141804/https://www.cuemath.com/calculus/order-of-differential-equationweb.archive.org/web/20220730032908/https://www.mathsisfun.com/calculus/differential-equations.html

Where this page came from

This page was imported from Wikibooks. From “MATLAB Programming” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

이 페이지가 속한 매거진MATLAB Programming

언어English

이용 허락: CC BY-SA 4.0 · 출처 en.wikibooks.org

견해

코멘트

Spinner Logo
버전: 2CC0 1.0 (퍼블릭 도메인)
The runaway star that left the Tarantula Nebula
버전: 2CC0 1.0 (퍼블릭 도메인)
The Eagle Nebula, seen in the infrared
버전: 2CC0 1.0 (퍼블릭 도메인)
The Cosmic Cliffs are not cliffs
버전: 2CC0 1.0 (퍼블릭 도메인)
The recommended targets are real, but the largest health gain is between doing nothing and doing a little. That is the part worth knowing if you are starting from nothing.
버전: 2CC0 1.0 (퍼블릭 도메인)
Sleep is not one state but a cycle through several, each doing different work. Most sleep disorders are a failure to complete that cycle rather than a shortage of hours.
버전: 2CC0 1.0 (퍼블릭 도메인)
Four nebulae that revealed the shape of our galaxy