1 / 20

Numerical integration

Numerical integration. x. Initial value problem. function dy = GeneDE ( t,y,p ) betam = p(1); alpham = p(2); q = p(3); alpha = p(4); dy = zeros(2,1); dy (1) = betam - alpham *y(1); dy (2) = q*y(1) - alpha*y(2 );. MatLab example.

kyna
Télécharger la présentation

Numerical integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Numerical integration x Initial value problem functiondy = GeneDE(t,y,p) betam = p(1); alpham = p(2); q = p(3); alpha = p(4); dy = zeros(2,1); dy(1) = betam - alpham*y(1); dy(2) = q*y(1) - alpha*y(2); MatLab example betam= 1/10; alpham= 1/30; q = 10; alpha = 1/30;% Parameters MaxTime= 60; % Integration time Yinitial= 0; Yminitial= 0;% Initial conditions [T,Y] = ode45(@GeneDE,[0 MaxTime],[YminitialYinitial],[],[betamalpham q alpha]); h = figure; subplot(2,1,1); plot(T,Y(:,1),'r','LineWidth',2); set(gca,'FontSize',12); title('Model with mRNA and protein explicitly separated: mRNA'); xlabel('t'); ylabel('Ym'); subplot(2,1,2); plot(T,Y(:,2),'LineWidth',2); set(gca,'FontSize',12); title('Model with mRNA and protein explicitly separated: Protein'); xlabel('t'); ylabel('Y'); t

  2. Initial value problem: Equations x Given: How a system state turns into a future system state Given: Initial condition Want: Trajectory of system x0(t0) t

  3. Initial value problem: Illustration x x0(t0) h t

  4. First approximation: Euler method xEULER(t0 + h) x x0(t0) h t

  5. Back up a bit to estimate more representative slope xEULER(t0 + h) x x0(t0) h t

  6. Back up a bit to estimate more representative slope xEULER(t0 + h) x x2ND ORDER(t0 + h) x0(t0) h t

  7. Iterate . . . x x0(t0) t

  8. Iterate again . . . x x0(t0) t

  9. Iterate yet again . . . x x0(t0) t

  10. Error accumulates in the numerical solution x x(t) x0(t0) x2ND ORDER(t) t

  11. Quality control: Adaptive stepsize x x0(t0) h t

  12. Quality control: Adaptive stepsize x x0(t0) h/2 t

  13. Quality control: Adaptive stepsize x x0(t0) t

  14. Quality control: Adaptive stepsize x x0(t0) t

  15. Numerical integration x Initial value problem functiondy = GeneDE(t,y,p) betam = p(1); alpham = p(2); q = p(3); alpha = p(4); dy = zeros(2,1); dy(1) = betam - alpham*y(1); dy(2) = q*y(1) - alpha*y(2); MatLab example betam= 1/10; alpham= 1/30; q = 10; alpha = 1/30;% Parameters MaxTime= 60; % Integration time Yinitial= 0; Yminitial= 0;% Initial conditions [T,Y] = ode45(@GeneDE,[0 MaxTime],[YminitialYinitial],[],[betamalpham q alpha]); h = figure; subplot(2,1,1); plot(T,Y(:,1),'r','LineWidth',2); set(gca,'FontSize',12); title('Model with mRNA and protein explicitly separated: mRNA'); xlabel('t'); ylabel('Ym'); subplot(2,1,2); plot(T,Y(:,2),'LineWidth',2); set(gca,'FontSize',12); title('Model with mRNA and protein explicitly separated: Protein'); xlabel('t'); ylabel('Y'); t

  16. MatLab example x Given: How a system state turns into a future system state Given: Initial condition x0(t0) Want: Trajectory of system t

  17. MatLab example Script: Tell MatLab initial conditions, parameters, and time intervals. functiondy = GeneDE(t,y,p) Integrate the DE system. [T,Y] = ode45(@GeneDE…) Plot results.

  18. Create a file called GeneDE.m Script: Tell MatLab initial conditions, parameters, and time intervals. functiondy = GeneDE(t,y,p) %Extract parameters from p betam= p(1); alpham = p(2); q = p(3); alpha = p(4); % Format output as a column vector dy= zeros(2,1); % Specify differential equations dy(1) = betam - alpham*y(1); dy(2) = q*y(1) - alpha*y(2); Integrate the DE system. [T,Y] = ode45(@GeneDE…) Plot results.

  19. Create a file called RunGeneDE.m Script: Tell MatLab initial conditions, parameters, and time intervals. functiondy = GeneDE(t,y,p) betam = p(1); alpham = p(2); q = p(3); alpha = p(4); dy = zeros(2,1); dy(1) = betam - alpham*y(1); dy(2) = q*y(1) - alpha*y(2); Integrate the DE system. [T,Y] = ode45(@GeneDE…) Plot results.

  20. Fill in RunGeneDE.m and run betam= 1/10; alpham= 1/30; q = 10; alpha = 1/30;% Parameters MaxTime= 60; % Integration time Yinitial= 0; Yminitial= 0;% Initial conditions [T,Y] = ode45(@GeneDE,[0 MaxTime],[YminitialYinitial],[],[betamalpham q alpha]); h = figure; subplot(2,1,1); plot(T,Y(:,1),'r','LineWidth',2); set(gca,'FontSize',12); title('Model with mRNA and protein explicitly separated: mRNA'); xlabel('t'); ylabel('Ym'); subplot(2,1,2); plot(T,Y(:,2),'LineWidth',2); set(gca,'FontSize',12); title('Model with mRNA and protein explicitly separated: Protein'); xlabel('t'); ylabel('Y'); functiondy = GeneDE(t,y,p) betam = p(1); alpham = p(2); q = p(3); alpha = p(4); dy = zeros(2,1); dy(1) = betam - alpham*y(1); dy(2) = q*y(1) - alpha*y(2);

More Related