Code 12
fs=500;
t=0:1/fs:0.1;
y1=t;
subplot(2,2,1);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('ramp signal');
%generation of ramp sequence
subplot(2,2,2);
stem(y1);
xlabel('n');
ylabel('amplitude');
title('ramp sequence');
%generation of impulse signal
y2=(t==0);
subplot(2,2,3);
plot(t,y2); axis([-1 1 0
1]) xlabel('time');
ylabel('amplitude');
title('impulse signal');
%generation of impulse sequence
subplot(2,2,4);
stem(y2);
xlabel('n');
ylabel('amplitude');
title('impulse sequence');
%generation of unit step signal
n=-10:1:10;
y3=(n>=0);
figure;
subplot(2,2,1);
plot(n,y3);
xlabel('time');
ylabel('amplitude');
title('unit step signal');
%generation of unit step sequence
subplot(2,2,2);
stem(n,y3);
xlabel('n');
ylabel('amplitude');
title('unit step sequence');
%generation of square wave signal
y4=square(2*pi*50*t);
subplot(2,2,3);
plot(t,y4);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title('square wave signal');
%generation of square wave sequence
subplot(2,2,4);
stem(y4);
xlabel('n');
ylabel('amplitude');
title('square wave sequence');
%generation of sawtooth signal
y5=sawtooth(2*pi*50*t);
figure;
subplot(2,2,1);
plot(t,y5);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title('sawtooth wave signal');
%generation of sawtooth sequence
subplot(2,2,2);
stem(y5);
xlabel('n');
ylabel('amplitude');
title('sawtooth wave sequence');
%generation of triangular wave signal
y6=sawtooth(2*pi*50*t,.5);
subplot(2,2,3);
plot(t,y6);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title(' triangular wave signal');
%generation of triangular wave sequence
subplot(2,2,4);
stem(y6);
xlabel('n');
ylabel('amplitude');
title('triangular wave sequence');
%generation of sinsoidal wave signal
y7=sin(2*pi*50*t);
figure;
subplot(2,2,1);
plot(t,y7);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title(' sinsoidal wave signal');
%generation of sin wave sequence
subplot(2,2,2);
stem(y7);
xlabel('n');
ylabel('amplitude');
title('sin wave sequence');
%generation of sinc signal
t1=linspace(-5,5);
y8=sinc(t1);
subplot(2,2,3);
plot(t1,y8);
xlabel('time');
ylabel('amplitude');
title(' sinc signal');
%generation of sinc sequence
subplot(2,2,4);
stem(y8);
11
xlabel('n');
ylabel('amplitude');
title('sinc sequence');
Comments
Post a Comment