Ordinary differential equation (ode) Extra question & Matlab Apps /4/23 Example Solve the following problem to find for with


Download 0.62 Mb.
Sana08.11.2023
Hajmi0.62 Mb.
#1758374
Bog'liq
Class Day 9

ORDINARY DIFFERENTIAL EQUATION (ODE) Extra question & Matlab Apps

1/4/23

Example 1 Solve the following problem to find for

with

  • Develop your own MATLAB programming.
  • Use the MATLAB built in function ode23.
  •  

 

with

Develop your own MATLAB programming.

  •  

% dy/dx=3sinx, y(0)=0

% dy/dx=3sinx, y(0)=0

%Step 1: Define x1, x2, x3,...

delx=pi/10;

x=0:delx: 2*pi;

%Step 2: define f(x)=dydx

f=@(x) 3*sin(x);

%Step 3: define the initial condition y(0)=0

y(1)=0;

%Step 4: Implement the numerical scheme y_i+1=y_i+delx f_i

for i=1: length(x)-1

y(i+1)=y(i)+delx*f(x(i))

end

%Step 5: plot the solution

plot(x,y)

 

with

Use the MATLAB built in function ode23

  •  

clear

clear

% dy/dx=3sinx, y(0)=0

%Step 1: Define x1, x2, x3,...

delx=pi/10;

x=0:delx: 2*pi;

%Step 2: define f(x)=dydx

f=@(x) 3*sin(x);

%Step 3: define the initial condition y(0)=0

y0=0;

%Step 4: use ode23

[x,y] = ode23(@(x,y) f(x), x, y0);

%plot the solution

plot(x,y)

Exercise Solve the following problem to find for

with

  • Develop your own MATLAB programming.
  • Use the MATLAB built in function ode23.
  •  

Example 2- Drug Dosing

Consider a patient who is being given morphine at a rate of 2.5 mg/hr. Their body metabolizes the drug at a rate of 30% per hour.

Write a differential equation for the amount of morphine in the patient over time.

Rate of morphine given to the patient: 2.5mg/hr


Morphine inside patient’s body
Rate of morphine being metabolizes
(30/100)*M(t)/hr

The Differential Equation

Write a differential equation for the amount of morphine in the patient over time.

Rate of morphine given to the patient: 2.5mg/hr


Morphine inside patient’s body
Rate of morphine being metabolizes
(30/100)*M(t)/hr
The rate of morphine inside the body=rate in- rate out

The analytical solution

  •  

Substitute the Initial condition,

Plot the numerical solution

  •  

Design the MATLAB Apps

Share your ideas!

Exercise- Aquarium

An aquarium holding 25 of water at a zoo is kept clean using a large pipe system equipped with filters. Water is pumped into and out of the aquarium at constant rate of per day. In the pipe flowing into the aquarium, a filter has broken down, so ammonia (toxic to fish) is flowing into the tank with the water, at a concentration of 150 g / . The water in the aquarium starts out at time t = 0 free of ammonia.

Write a differential equation for the amount of ammonia in the aquarium over time.

Rate of ammonia into the aquarium 150 g / per day

=

  •  

S
Ammonia in Aquarium
Rate of ammonia flow out
per day

Exercise- Aquarium

Write a differential equation for the amount of ammonia in the aquarium over time.

Rate of ammonia into the aquarium 150 g / per day

=

  •  

S
Ammonia in Aquarium
Rate of ammonia flow out
per day

Exercise- Aquarium


  • Plot both analytical and numerical solution on one graph
  • Design the Matlab Apps to estimate the ammonia concentration inside the aquarium

Final Assessment

Develop a MATLAB Apps that related to the application of Ordinary Differential Equation in real life problem.

You will need to 1. Submit a report (Individually) 60%

2. Present about your MATLAB Apps (Work in group) 40%

The Report

  • Submit individually
  • About 5-10 pages
  • The report must consists 2 parts:
  • Part I: About this course What you have learned in this course? How do you feel about this course? How this course can benefit you in future?

    Part II: About your MATLAB Apps The background of the problem The objective of the Apps The programming and design

    Summary

The Presentation

  • Group work
  • Explain about your MATLAB Apps The background of the problem The objective of the Apps The programming and design
  • Summary

  • Try to convince why people should use your MATLAB Apps.

RAHMAT
Download 0.62 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling