MATLAB 1

# MATLAB 1 - Matlab#1 Leonard Harpster A06802204 C03 Exercise...

This preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: Matlab #1 Leonard Harpster A06802204 C03 1/18/07 Exercise 1.1 log (20)/log (10) ans = 1.3010 Exercise 1.2 m takes three numbers such that it starts at the first number and adds that to the second number until it reaches the third number. The m function stores this matrix so that you can call it up with m (some number in matrix). Exercise 1.3 z = 25-(100-7*(exp(5+cos(pi/3)))) z= 1.6378e+003 Exercise 1.4 f = inline('sin(x)/x') f= Inline function: f(x) = sin(x)/x fplot(f, [-20, 20]) figure ezplot(f, [-20,20]) 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -20 -15 -10 -5 0 5 10 15 20 sin (x)/x 0 .5 0 .4 0 .3 0 .2 0 .1 0 -0 .1 -0 .2 -20 -15 -10 -5 0 x 5 1 0 15 2 0 On the top is the fplot graph, which is the better graph in this case because it doesn't cut off the function on the y-axis. Though it does list the function on top. Exercise 1.5 a) function sum = mysum(r, n); sum = 0; for i = 0:n sum = sum + 1/(r^i); end b) y = mysum (3, 1000) y= 1.5000 Exercise 1.6 a) diff ('ln(sin(t)+4*s)', 't') ans = cos(t)/(sin(t)+4*s) b) diff ('ln(sin(t)+4*s)', 's') ans = 4/(sin(t)+4*s) Exercise 1.7 a) b) dsolve ('Dy = cos(t)') ans = sin(t)+C1 c) dsolve ('Dy = cos(t)', 'y(0) = 3') ans = sin(t)+3 Exercise 1.8 dsolve('Dy = y*cos(y^2)') Warning: Explicit solution could not be found; implicit solution returned. > In dsolve at 321 ans = t-Int(1/_a/cos(_a^2),_a = .. y)+C1 = 0 ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online