recitation problems for matlab week 4

recitation problems for matlab week 4 - Practice Exercises...

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

View Full Document Right Arrow Icon
Practice Exercises 5.1 x=[0:0.1*pi:2*pi] x = Columns 1 through 13 0 0.3142 0.6283 0.9425 1.2566 1.5708 1.8850 2.1991 2.5133 2.8274 3.1416 3.4558 3.7699 Columns 14 through 21 4.0841 4.3982 4.7124 5.0265 5.3407 5.6549 5.9690 6.2832 y=sin(x) y = Columns 1 through 13 0 0.3090 0.5878 0.8090 0.9511 1.0000 0.9511 0.8090 0.5878 0.3090 0.0000 -0.3090 -0.5878 Columns 14 through 21 -0.8090 -0.9511 -1.0000 -0.9511 -0.8090 -0.5878 -0.3090 -0.0000 plot(x,y) grid on title('graph of sin(x)') xlabel('x') ylabel('y') y1=sin(x) y1 = Columns 1 through 13 0 0.3090 0.5878 0.8090 0.9511 1.0000 0.9511 0.8090 0.5878 0.3090 0.0000 -0.3090 -0.5878 Columns 14 through 21 -0.8090 -0.9511 -1.0000 -0.9511 -0.8090 -0.5878 -0.3090 -0.0000 y2=cos(x) y2 = Columns 1 through 13
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.0000 0.9511 0.8090 0.5878 0.3090 0.0000 -0.3090 -0.5878 -0.8090 -0.9511 -1.0000 -0.9511 -0.8090 Columns 14 through 21 -0.5878 -0.3090 -0.0000 0.3090 0.5878 0.8090 0.9511 1.0000 plot(x,y1); plot(x,y2) plot(x,y1) plot(x,y2) title('graph of cosx') xlabel('x') ylabel('y') grid on plot(x,y1,'r--') grid on title('graph of sinx') xlabel('x') ylabel('y') grid on plot(x,y2,'g:') grid on title('graph of cosx') xlabel('x') ylabel('y') legend('sinx','location','nw') plot(x,y1,'r--') grid on title('graph of sinx') xlabel('x') ylabel('y') grid on legend('cosx','location','nw')
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

recitation problems for matlab week 4 - Practice Exercises...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online