Lab 2

# Lab 2 - LAB 2 Name_Ryan Corley Sec_4 Examples from Lab 2...

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

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: LAB 2 Name: __Ryan Corley ___ Sec_4 _ Examples from Lab 2 Module Example 1 : Choose any 4 x 4 matrix yourself. Call it A. Compute A * A and A .* A. A=[1,2,3,4;4,3,2,1;3,4,2,1;2,1,3,4] A = 1 2 3 4 4 3 2 1 3 4 2 1 2 1 3 4 A*A [ A.*A] ans ans 26 24 25 25 1 4 9 16 24 26 25 25 16 9 4 1 27 27 24 22 9 16 4 1 23 23 26 28 4 1 9 16 Example 2 : Plot sin(4x ) for x in the interval [-2 π , 2 π ] using both the fplot command and the plot command in MATLAB. Experiment with point and line options also. fplot ('sin(4*x)', [-2*pi 2*pi]) -6-4-2 2 4 6-1-0.8-0.6-0.4-0.2 0.2 0.4 0.6 0.8 1 Example 3: Plot both sin(3x) and cos(3x) simultaneously for x in the interval [0, 3 π ] using the plot command in MATLAB. fplot('[sin(3*x), cos(3*x)]', [0 3*pi]) 1 2 3 4 5 6 7 8 9-1-0.8-0.6-0.4-0.2 0.2 0.4 0.6 0.8 1 Example 4 : Label the plot (i.e. the X-Axis, the Y-Axis, and a title) obtained in the previous example. Use legends in MATLAB to distinguish the functions....
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

Lab 2 - LAB 2 Name_Ryan Corley Sec_4 Examples from Lab 2...

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

View Full Document
Ask a homework question - tutors are online