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

**Unformatted text preview: **Exercise : write an M file cosy.m that defines the function f(x) = cos ( x ) - x (Remember how, in lab #2, we talked about how to set up a function? Do not spend time trying to make this function fancy.) function A = name ( input ) result = . .. Note that MATLAB has a special command for plotting functions that's easier than what we normally do. For instance, we could plot cosy from -4.0 to 4.0 by typing: fplot ( 'cosy', [ -4.0, 4.0 ] ) Note the quotes around the function name, and the square brackets that make the x limits a vector. Now would be a good time to try the fplot command out, and see what the cosy function looks like. Can you add an x axis using hold on and the appropriate plot command?...

View
Full
Document