tutorial
play

Tutorial Verification Numerical Simulation Analytic and Numerical - PowerPoint PPT Presentation

BENG 221 Lecture 4 Tutorial BENG 221 Mathematical Methods in Bioengineering Overview Example: Ring Oscillator Dynamics Lecture 4 Analytic ODE Solution Numerical Tutorial Verification Numerical Simulation Analytic and Numerical


  1. BENG 221 Lecture 4 Tutorial BENG 221 Mathematical Methods in Bioengineering Overview Example: Ring Oscillator Dynamics Lecture 4 Analytic ODE Solution Numerical Tutorial Verification Numerical Simulation Analytic and Numerical Methods in ODEs Further Reading Gert Cauwenberghs Department of Bioengineering UC San Diego 4.1

  2. BENG 221 Summary Lecture 4 Tutorial Overview Example: Ring Oscillator Dynamics Analytic ODE Solution We will review analytic and numerical techniques for solving Numerical ODEs, using pencil and paper, and implemented in Matlab. Verification These simple techniques lay the foundations for solving more Numerical Simulation complex systems of PDEs in the coming weeks. Further Reading By way of example we study the dynamics of a ring oscillator , a circular chain of three inverters with identical capacitive loading. 4.2

  3. BENG 221 Today’s Coverage: Lecture 4 Tutorial Overview Example: Ring Oscillator Dynamics Example: Ring Oscillator Dynamics Analytic ODE Solution Numerical Verification Analytic ODE Solution Numerical Simulation Further Reading Numerical Verification Numerical Simulation 4.3

  4. BENG 221 Some circuit elements Lecture 4 Tutorial Overview Example: Ring Oscillator Dynamics Analytic ODE Solution Numerical Verification Numerical Simulation Further Reading Figure: An inverting Figure: A capacitor converts transconductor (inverter) charge, or integrated current, to converts and input voltage to an voltage with gain 1 / C . output current, with gain − G . � t v = Q C = 1 i dt (2) i out = g ( v in ) ≈ − Gv in (1) C −∞ 4.4

  5. BENG 221 Ring Oscillator Lecture 4 Tutorial Overview Example: Ring Oscillator Dynamics Analytic ODE Solution Numerical Verification Numerical Figure: A 3-inverter ring oscillator with capacitive loading. Simulation Further Reading C dv 1 = g ( v 3 ) ≈ − G v 3 dt v 1 ( 0 ) = v 10 C dv 2 = g ( v 1 ) ≈ − G v 1 (3) v 2 ( 0 ) = v 20 (4) dt v 3 ( 0 ) = v 30 C dv 3 = g ( v 2 ) ≈ − G v 2 dt 4.5

  6. BENG 221 Eigenvalues Lecture 4 Tutorial Ring oscillator ODE dynamics in matrix notation: d v dt = Av v ( 0 ) = v 0 Overview (5) Example: Ring Oscillator with Dynamics Analytic ODE       v 1 0 0 − 1 v 10 Solution v = v 2 A = − 1 0 0 v ( 0 ) = v 20 (6) Numerical       Verification v 3 0 − 1 0 v 30 Numerical Simulation where G / C ≡ 1 with no loss of generality. Further Reading Eigenvectors x i and corresponding eigenvalues λ i of A satisfy 3 + 1 = 0, A x i = λ i x i , or det ( A − λ i I ) = 0, which reduces to λ i with three solutions:  − 1  √  e + j π/ 3 = 1 1 3 = 3 λ i = ( − 1 ) 2 + j (7) 2 √ e − j π/ 3 = 1 3  2 − j  2 4.6

  7. BENG 221 Eigenvectors Lecture 4 Tutorial The corresponding eigenvectors are: Overview Example: Ring   Oscillator 1 Dynamics 1 λ 1 = − 1 : x 1 = 1 √ Analytic ODE   3 Solution 1 Numerical   1 Verification √ e + j π/ 3 = 1 3 1 e + j 2 π/ 3 λ 2 = 2 + j 2 : x 2 = √ (8) Numerical   3 Simulation e − j 2 π/ 3 Further Reading   1 √ e − j π/ 3 = 1 3 1 e − j 2 π/ 3 λ 3 = 2 − j 2 : x 3 = √   3 e + j 2 π/ 3 The eigenvectors form a complex orthonormal basis: ∗ x j = δ ij , x i i , j = 1 , . . . 3 (9) where x i ∗ is the complex conjugate transpose of x i . 4.7

  8. BENG 221 Eigenmodes Lecture 4 Tutorial The general solution is the superposition of eigenmodes (see Lecture 1): Overview 3 Example: Ring Oscillator � c i x i e λ i t v = Dynamics Analytic ODE i = 1 Solution   1 Numerical 1 c 1 e − t  + Verification = √ 1 (10)  3 Numerical 1 Simulation Further Reading   1 1 2 t e j 1 √ 3  + 2 t e + j 2 π/ 3 c 2 e √  3 e − j 2 π/ 3   1 1 2 t e − j √ 1 3 2 t e − j 2 π/ 3 c 3 e √   3 e + j 2 π/ 3 v ( t ) is real, and so c 2 and c 3 must be complex conjugate. Therefore, the second and third eigenmodes are oscillatory with an exponentially rising carrier. The first eigenmode is a decaying exponential common-mode transient. 4.8

  9. BENG 221 First Eigenmode– Common-mode Decaying Exponential Lecture 4 Tutorial IC: (1 1 1) 1.2 v1 v2 Overview v3 Example: Ring 1 Oscillator Dynamics Analytic ODE Solution 0.8 Numerical Verification Numerical 0.6 Simulation Further Reading 0.4 0.2 0 0 1 2 3 4 5 6 7 8 9 10 t Figure: Ring oscillator ODE solution for v ( 0 ) = ( 1 , 1 , 1 ) T . 4.9

  10. BENG 221 Second/third Eigenmode– Exponentially Rising Three-phase Lecture 4 Oscillations Tutorial IC: (1 − 0.5 − 0.5) 150 Overview v1 Example: Ring v2 Oscillator v3 Dynamics 100 Analytic ODE Solution Numerical 50 Verification Numerical Simulation Further Reading 0 − 50 − 100 − 150 0 1 2 3 4 5 6 7 8 9 10 t 2 ) T . Figure: Ring oscillator ODE solution for v ( 0 ) = ( 1 , − 1 2 , − 1 4.10

  11. BENG 221 Initial Conditions Lecture 4 Tutorial The IC constrained solution is obtained by virtue of the Overview orthonormality of the eigenvectors (see also Lecture 1): Example: Ring Oscillator Dynamics n � x ∗ i v ( 0 ) x i e λ i t Analytic ODE v = (11) Solution i = 1 Numerical Verification which, using the identity e + j α + e − j α = 2 cos ( α ) , leads to: Numerical Simulation Further Reading e − t v 1 = ( v 10 + v 20 + v 30 ) + (12) 3 √ 2 e t / 2 3 ( v 10 cos ( 2 t ) + 3 √ √ 2 t + 2 π 3 2 t − 2 π 3 v 20 cos ( 3 ) + v 30 cos ( 3 )) and identical expressions for v 2 and v 3 under ordered permutation of the indices (consistent with the ring symmetry). 4.11

  12. BENG 221 Matlab Implementation Lecture 4 Tutorial Overview Example: Ring Oscillator Using the eigenvector-eigenvalue decomposition of A in matrix Dynamics Analytic ODE form: Solution A X = X s (13) Numerical Verification where X = ( x 1 , x 2 , x 3 ) and s = diag ( λ 1 , λ 2 , λ 3 ) , the solution (11) Numerical Simulation can be expressed in matrix form: Further Reading v = X diag ( X ∗ v ( 0 )) e diag ( s ) t (14) for efficient matlab implementation: [X, s] = eig(A); V = X * diag(X’ * V0) * exp(diag(s) * t); 4.12

  13. BENG 221 Initial Conditions Lecture 4 Tutorial IC: (1 0 0) 100 v1 v2 Overview v3 80 Example: Ring Oscillator Dynamics 60 Analytic ODE Solution 40 Numerical Verification 20 Numerical Simulation 0 Further Reading − 20 − 40 − 60 − 80 0 1 2 3 4 5 6 7 8 9 10 t Figure: Ring oscillator ODE solution for v ( 0 ) = ( 1 , 0 , 0 ) T . 4.13

  14. BENG 221 Euler Integration Lecture 4 Tutorial Euler numerical integration produces approximate solutions to: Overview d x dt = f ( x ( t ) , t ) (15) Example: Ring Oscillator Dynamics Analytic ODE at discrete time intervals t = n ∆ t , by finite difference Solution approximation of the derivative: Numerical Verification d x dt ( t ) = 1 Numerical ∆ t ( x ( t + ∆ t ) − x ( t )) + O (∆ t 2 ) (16) Simulation Further Reading leading to the recursion: x ( t + ∆ t ) ≈ x ( t ) + ∆ t f ( x ( t ) , t ) . (17) Matlab Euler example (ring oscillator): Ve = V0; % Euler approximation, initialize to IC Vs = V0; % Euler state variable, initialize for te = tstep:tstep:trange Vs = Vs + A * Vs * tstep; Ve = [Ve, Vs]; end 4.14

  15. BENG 221 Euler Integration Lecture 4 Tutorial IC: (1 0 0) 150 v1 v2 Overview v3 Example: Ring Oscillator 100 Dynamics Analytic ODE Solution Numerical 50 Verification Numerical Simulation Further Reading 0 − 50 − 100 0 1 2 3 4 5 6 7 8 9 10 t Figure: Ring oscillator ODE simulation using Euler integration. 4.15

  16. BENG 221 Crank-Nicolson Integration Lecture 4 Tutorial Better numerical ODE methods exist that use higher-order finite difference approximations of the derivative. Crank-Nicolson is a Overview second order method that approximates (15) more accurately Example: Ring using a centered version of the finite difference approximation of Oscillator Dynamics the derivative: Analytic ODE Solution d x dt ( t + ∆ t 2 ) = 1 ∆ t ( x ( t + ∆ t ) − x ( t )) + O (∆ t 3 ) (18) Numerical Verification Numerical leading to a recursion: Simulation Further Reading x ( t ) + ∆ t f ( x ( t + ∆ t 2 ) , t + ∆ t x ( t + ∆ t ) ≈ 2 ) x ( t ) + ∆ t ≈ 2 ( f ( x ( t ) , t ) + f ( x ( t + ∆ t ) , t + ∆ t )) . (19) Matlab CN example (ring oscillator): G = (eye(3) - A * tstep / 2) \ (eye(3) + A * tstep / 2); Vc = V0; % CN approximation, initialize to IC Vs = V0; % CN state variable, initialize for te = tstep:tstep:trange Vs = G * Vs; Vc = [Vc, Vs]; 4.16 end

  17. BENG 221 Crank-Nicolson Integration Lecture 4 Tutorial IC: (1 0 0) 100 v1 v2 Overview v3 80 Example: Ring Oscillator Dynamics 60 Analytic ODE Solution 40 Numerical Verification 20 Numerical Simulation 0 Further Reading − 20 − 40 − 60 − 80 0 1 2 3 4 5 6 7 8 9 10 t Figure: Ring oscillator ODE simulation using Crank-Nicolson integration. 4.17

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend