Unformatted text preview: CSC 113
Lab Assignment 3
1. Write a MATLAB script ﬁle that computes and plots 5 cycles of a sine wave as a function
of time.
Assume the sine wave has a frequency of f = 100 Hz, an amplitude of A = 0.9, and a
phase angle of φ = 45 degrees. The equation of the sine wave is given by
y(t ) = A sin(2π f t + φ )
2. Write a script that on the same graph plots the following curves:
(a) y1 (x) = 10 cos(x2 );
√
(b) y2 (x) = 15/ x2 + 5
2 (c) y3 (x) = 10 e−(x+3) Assume that x ranges from −1 to +1. Use enough values of x so that the curves look
smooth. In addition:
• Add labels to the x and y axes;
• Add a title to the graph;
• Add a legend to the graph;
• Force the y1 curve to be a solid red line;
• Force the y2 curve to be a dashed blue line with ‘+’ markers;
• Force the y3 curve to be a dasheddot green curve with the ‘◦’ marker.
3. Use the surf command (short for “surface”) to graph the function
z(x, y) = cos 15 x2 + y2 ∗ e−2(x 2 +y2 ) for −1 ≤ x ≤ 1 and −1 ≤ y ≤ 1.
(a) Add labels to the x, y and z axes;
(b) Add a title to the graph;
(c) Compare the output with the plot generated using the mesh commmand. ...
View
Full Document
 Fall '10
 PhillipRegali
 red line, Sine wave, 45 degrees

Click to edit the document details