{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Matlab 1

# Matlab 1 - Fplot seems to provide a better graph in this...

This preview shows pages 1–4. Sign up to view the full content.

MATLAB Assignment 3 Modeling with Differential Equations Exercise 1.1 >> log(20)/log(10) ans = 1.3010 Exercise 1.2 m = -3:0.4:12 started at -3 and added 0.4 to the resulting value until it reached 12 or got as close to 12 without going over. m(20) will take the previous command and give the 20 th answer Exercise 1.3 >> z=30-(100-2exp(4-sin(pi/6)) ??? z=30-(100-2exp(4-sin(pi/6)) | Error: Unexpected MATLAB operator. >> z=30-(100-2*exp(4-sin(pi/6))) z = -3.7691 Exercise 1.4 >> g=inline('sin(x)/x') g = Inline function: g(x) = sin(x)/x >> fplot(g,[-25,25]) >> title('The result of fplot')

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

View Full Document
>> figure >> ezplot(g,[-25,25]) >> title('The result of ezplot') -25 -20 -15 -10 -5 0 5 10 15 20 25 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 0.25 0.3 x The result of ezplot -25 -20 -15 -10 -5 0 5 10 15 20 25 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 The result of fplot

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fplot seems to provide a better graph in this case because ezplot doesn’t show the top of the curve at x=0. Exercise 1.5 function sum = mysum(r,n); sum = 0; for i=0:n sum = sum + 1/((x)^i); end >> mysum(4,8) ans = 1.3333 Exercise 1.6 >> diff('log(cos(t)+4*s)', 't') ans =-sin(t)/(cos(t)+4*s) >> diff('log(cos(t)+4*s)','s') ans = 4/(cos(t)+4*s) Exercise 1.7 a. b. >> dsolve('Dy=cos(t)') ans = sin(t)+C1 c. >> dsolve('Dy=cos(t)','y(0)=5') ans = sin(t)+5 Exercise 1.8 >> dsolve('Dy=(y^4-2)/t') Warning: Explicit solution could not be found; implicit solution returned. > In dsolve at 315 ans = log(t)+1/8*2^(1/4)*log((y+2^(1/4))/(y-2^(1/4))) +1/4*2^(1/4)*atan(1/2*y*2^(3/4))+C1 = 0...
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

Matlab 1 - Fplot seems to provide a better graph in this...

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

View Full Document
Ask a homework question - tutors are online