upas matlab - iv reprise some topics – repetition is good

32
06/18/14 UIC – MATLAB Physics 1 UPAS MATLAB - IV Reprise some topics – repetition is good. Readunderstand the scripts rather than just executing them. Grid based solutions of pde's. A few new topics

Upload: others

Post on 28-Oct-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 1

UPAS MATLAB - IV

● Reprise some topics – repetition is good. Readunderstand the scripts rather than just executing them.

● Grid based solutions of pde's.

● A few new topics

Page 2: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 2

GUI_DEMO

● Look at script. Run through a palatte. This has only pushbuttons

Page 3: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 3

Construct a GUI

● Suggest a script to be wrapped .....● Project?

Page 4: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 4

Callbacks

● e.g. pushbutton● Look at other GUI for menu, executable text,

pb, sliders, etc.

Page 5: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 5

Perihelion Advance

● Use to explore callbacks for sliders; 2.1,1.0,1.33,0

● 1/r^n is attractive

But L^2/r^3

Repulsive - minimum?

● Stable orbits?

● re-entrant?

● Generalized cm_kepl3

Page 6: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 6

plot_demo

● tools/edit plot/ - insert; x,y, title, etc.

Page 7: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 7

demo_3d

● View – dropdown menu● Tools – rotate 3d● Edit plot dynamically using tools for figures

Page 8: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 8

ode45

● Look at ode_demo● odedemofun● Simplest first order RK – gets started● Many script

example canbe used (e.g. cm_kepl3)

Page 9: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 9

Symbolic ode wrapper – use it

Suggest an ODE to solvecompletely general

Project?

Page 10: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 10

Thin Lense Doublet

Focal lengths for the 3Conditions. Try to prove one.Project?

Page 11: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 11

Doublet - II

Solutions arise from imposing focal constraints on the M5 matrix elements. TwoUnknowns, f1 and f2. Two conditions onThe matrix element in the x and y planes

Page 12: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 12

Spherical_Lens2

● Aperture abberations – 40 and 10 degrees – fill the spherical lense

● Useful aperture!

Page 13: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 13

SR_Time_Dilate

● Demo – proper time and interval – subplot = see also Damped_Driven_SHO

● 4 subplots there

Geometrically proveThat t is dilated by gamma

Page 14: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 14

Solving pde

● MATLAB has pde solver for 1 x and 1 d dimensions. Use in 1-d quantum mech.

● Other methods include representing the pde on a grid and solving numerically.

● 1-d grid – Gen_Eigen2 – use MATLAB eig● Laplace eq. solution using complex variables● 2-d grid – Laplace using BC and grid● 2-d grid – Poisson using grid, FFT

Page 15: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 15

Eigenfunctions

● 1-d grid

Page 16: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 16

Hamiltonian Matrix

Page 17: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 17

QM - Gen_Eigen2

● Use MATLAB to find eigenvalues and eigenfunctions (time independent eq) for a very large (1000,1000) but sparse matrix. Grid for second derivative in x

Need 3 grid points ~ d2/dx2

Page 18: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 18

Laplace_z - Complex

Page 19: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 19

Iterative Grid

● Use the approximate grid for Poisson and Laplace Eq. To solve by iteration.

● For (x,y) space – not implemented in MATLAB.

1 2, 1, 1, , 1 , 1 ,1/ 4[ ]n n n n nj l j l j l j l j l j lu u u u u ρ+

+ − + −= + + + − ∆

Page 20: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 20

Laplace Eq in 2d - grid

● 2-d PDE

Fix BC arbitrarySolve interior asNo sources – second orderPartials in x and y = 0.Need 5 grid points

Page 21: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 21

Example

● Use EM_Laplace_Test2● Specify BC on a rectangular boundary● Flexible boundary values - symbolic

Page 22: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 22

Example - II

● 10 Iterations – start from mean voltage.● Fairly slow - Gauss-Seidel

Page 23: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 23

Laplace_Series

● Do effectively a Fourier series to match BC,

Page 24: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 24

EM_Poisson_Test

● Solve for point and rectangular charges (e.g. parallel plate capacitor). Grid solution. Boundaries = 0 (note CMS magnet !)

● Uses MATLAB package for FFT; round, zeros,fft2, ifft2

Page 25: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 25

1 rectangle

● E fields

Page 26: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 26

Poisson - II

● Make FT of sources. Then solve for FT of potential analytically. Use inverse FT, ifft2 to put potential back into (x,y). MATLAB tools.

Page 27: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 27

Poisson - III

● Ey and quiver – example for parallel plate capacitor model.

Page 28: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 28

Coupled SHO

● Coupled objects – normal modes and eigenvalues, “cm_2sho”

Page 29: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 29

cm_triatomic

● Can setup eigenvectors as initial conditions

Page 30: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 30

Drum Oscillations

● Drum_Modes, series solutions vanish at r = 1● Wave equation – 2-d + time, Bessel functions

Page 31: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 31

Binary System

RK in ode45. Look for wobble of sun for planet at 0.1 solar mass at 1 AU

Page 32: UPAS MATLAB - IV Reprise some topics – repetition is good

06/18/14 UIC – MATLAB Physics 32

That all folks

● Thanks for being an attentive and active group

● This was a fun week● We look forward to see your projects.