Matlab assignment 3

Matlab assignment 3 - Anna Dang PID: A09192411 Math 20D...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Anna Dang PID: A09192411 Math 20D Professor: Bin Dong TAs name: Zezhon Zhang (section: A01) Matlab Assignment 3 Exercise3.1 Part a: Input: h = 0.5 h = 0.25 h = 0.1 h = 0.01 Input: >> f = inline('x^2 -1', 'x', 'y') >>h = 0.25 >> [x,y] =Euler(h, 0, 1, 2, f); >> [x,y] >> plot(x,y,'r') Output: f = Inline function: f(x,y) = x^2 -1 h = 0.5000 Input: >> f = inline('x^2 -1', 'x', 'y') >>h = 0.25 >> [x,y] =Euler(h, 0, 1, 2, f); >> [x,y] >> plot(x,y,'b') Output: f = Inline function: f(x,y) = x^2 -1 h = 0.2500 Input: >> f = inline('x^2 -1', 'x', 'y') >>h = 0.25 >> [x,y]= Euler(h, 0, 1, 2, f); >> [x,y] >> plot(x,y,'g') Output: f = Inline function: f(x,y) = x^2 -1 h = Value of x,y: Input: >> f = inline('x^2 -1', 'x', 'y') >>h = 0.25 >> [x,y] =Euler(h, 0, 1, 2, f); >> [x,y] >> plot(x,y,'c') Output: f = Inline function: f(x,y) = x^2 -1 h = 0.1000 Value of x,y: 0.5 1 1.5 2 2.5 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Value of x,y: x= 1.0000 , y = 0.1250 x= 2.0000 , y = 0.7500 Value of x,y: x= 1.0000 , y = 0.2188, y = 0....
View Full Document

Page1 / 7

Matlab assignment 3 - Anna Dang PID: A09192411 Math 20D...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online