Tutorial 1 solution

# Tutorial 1 solution - f=(x)expressioninx...

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

Format for Anonymous Functions f = @(x) expression in x g = @(u, v) expression in u and v Activity 1 1. On a piece of paper, write the code that will create these vectorized functions: ݂ሺݔሻൌ ݁ sinሺߨݔ ൅ >> [email protected](x) exp(x.^2).*sin(pi.*x + pi./2) ݃ሺݑ,ݒሻ ൌ 1000݁ ିሺ௨ ା௩ >> [email protected](u,v) 1000.*exp(–(u.^2 + v.^2)) 2. Trade papers with someone and input their code to see if it works. Test their code using these values (where you can easily determine the expected answers): a. f(0) = 1 b. f(1) = 2.71828 c. f(–0.5) = 0 d. f([0, 1, –0.5]) = [ 1, 2.71828, 0 ] e. g(0, 0) = 1000 f. g(1, 0) = g(0, 1) = g(–1, 0) = g(0, –1) = 367.8794 Activity 3 Sphere Dist uses latitude and longitude in decimals. Latitude and longitude can also be given in degrees, minutes, seconds. For example:
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online