Upcoming SlideShare
×

# Signals in matlab

670
-1

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
670
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
63
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Signals in matlab

1. 1. 10/23/2012 Signal in MATLABDOES - PC
2. 2. Plot of the Sine Function 1Sine Wave: 0.8 0.6 0.4 0.2 Sine of x 0>> x = 0:pi/100:2*pi; -0.2 -0.4>> y = sin(x); -0.6>> plot(x,y) -0.8 -1 0 1 2 3 4 5 6 7 x = 0:2OR 1 0.8>> y = sin(linspace(0,2*pi,10)); 0.6 0.4>> stem(y) 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 1 2 3 4 5 6 7 8 9 10
3. 3. Plot of the Sine Function 1 0.8Cosine Wave: 0.6 0.4 0.2 Sine of x 0 -0.2>> x = 0:pi/100:2*pi; -0.4>> y = sin(x); -0.6 -0.8>> plot(x,y) -1 0 1 2 3 4 5 6 7 x = 0:2OR 1 0.8 0.6 0.4>> y = cos(linspace(0,2*pi,10)); 0.2 0>> stem(y) -0.2 -0.4 -0.6 -0.8 -1 1 2 3 4 5 6 7 8 9 10
4. 4. Multiple Signals: 1 0.8>> x = 0:pi/100:2*pi; 0.6>> y = sin(x); 0.4 0.2>> y2 = sin(x-.25); 0>> y3 = sin(x-.5) -0.2 -0.4>> plot(x,y,x,y2,x,y3) -0.6 -0.8 -1 0 1 2 3 4 5 6 7
5. 5. Multiple Plots: 1 1t = 0:pi/100:2*pi; 0.5 0.5y1=sin(t); 0 0y2=sin(t+pi/2); -0.5 -0.5subplot(2,2,1) -1 0 2 4 6 8 -1 0 2 4 6 8plot(t,y1) 1 1subplot(2,2,2) 0.5 0.5plot(t,y2);subplot(2,2,3) 0 0plot(t,y1) -0.5 -0.5subplot(2,2,4) -1 -1 0 2 4 6 8 0 2 4 6 8plot(t,y2);
6. 6. Square Wave Wave: Squarewave Square wave 1 1 0.5 0.5 Amplitude Amplitude 0 0 -0.5 -0.5 -1 -1 0 50 100 0 50 100 Time Time >> t:0:100; >> y=square(2*pi*100*t/100,50); >> plot(t,y) >> stem(t,y)
7. 7. Ramp Signal Ramp Signal 20 20 15 15Ramp Signal: Amplitude Amplitude 10 10 5 5 0 0 0 5 10 15 20 0 5 10 15 20 sequence sequence >> t:0:20; >> plot(t,t); >> stem(t,t)
8. 8. 8 8 x 10 Exponential Signal x 10 Exponential Signal 6 6Exponential Signal: Amplitude Amplitude 4 4 2 2 0 0 0 5 10 15 20 0 5 10 15 20 sequence sequence >> t=0:20; >> y2=exp(t); >> plot(t,y2) >> stem(t,y2)
9. 9. unit impulse signal unit impulse signal 1 1Impulse Signal: Amplitude Amplitude 0.5 0.5 0 0 -2 -1 0 1 2 -2 -1 0 1 2 time time >> t=-2:1:2; >> y=[zeros(1,2),ones(1,1),zeros(1,2)]; >> plot(t,y); >> stem(t,y);
10. 10. Unit step sequence Unit step sequence 2 1Step Signal: 1.5 Amplitude Amplitude 1 0.5 0.5 0 0 0 5 10 15 20 0 5 10 15 20 No of sequence No of sequence >> t=0.1:n-1; >> y1=ones(1,n-1); >> plot(t,y1) >> stem(t,y1)
11. 11. Graph Functions:• plot linear plot• stem discrete plot• grid add grid lines• xlabel add X-axis label• ylabel add Y-axis label• title add graph title• subplot divide figure window• figure create new figure window• pause wait for user response
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.