0% found this document useful (0 votes)
42 views2 pages

Program2: 1.unit Step 2.exponential 3.unit Impulse 4.sine 5.cosine 6.signum 7.ramp 8.rectangle

The document describes a program to generate various discrete time domain signals including unit step, exponential, unit impulse, sine, cosine, signum, ramp and rectangle functions. It contains the MATLAB code to generate plots of these signals on a single figure with multiple subplots.

Uploaded by

tanuj agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Program2: 1.unit Step 2.exponential 3.unit Impulse 4.sine 5.cosine 6.signum 7.ramp 8.rectangle

The document describes a program to generate various discrete time domain signals including unit step, exponential, unit impulse, sine, cosine, signum, ramp and rectangle functions. It contains the MATLAB code to generate plots of these signals on a single figure with multiple subplots.

Uploaded by

tanuj agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PROGRAM2

AIM: Write a program for the following signals in discrete time domain.
1.Unit Step
2.Exponential
3.Unit Impulse
4.Sine
5.Cosine
6.Signum
7.Ramp
8.Rectangle
%unit step
n=-5:1:5; %cosine
x0=0; y4=cos(n)
x1=1; subplot(2,4,5);
y=x1.*(n>=0)+x0.*(n<0); stem(n,y4);
subplot(2,4,1); xlabel('time');
stem(n,y); ylabel('amplitude');
xlabel('time'); title('discrete cosine function');
ylabel('magnitude');
title('discrete step signal)'); %signum
n=-5:1:5;
%exponential y5=[-ones(1,5),zeros(1,1), ones(1,5)];
a=2; subplot(2,4,6);
y1=exp(a*n); plot(n,y5);
subplot(2,4,2); xlabel('time');
stem(n,y1); ylabel('amplitude');
xlabel('time'); title('discrete signum function');
ylabel('magnitude');
title('discrete with increasing exponential signal %ramp
'); y6=n;
subplot(2,4,7);
%unit impulse stem(n,y6);
y2=x1.*(n==0)+x0.*(n<0)+x0.*(n>0) ; label('time');
subplot(2,4,3); ylabel('amplitude');
stem(n,y2); title('discrete ramp function');
xlabel('time');
ylabel('magnitude'); %rectangle
title('discrete unit impulse'); n=-10:1:10;
f=0.3;
%sine x3=sin(2*f*n);
y3=sin(n) x4=-1;
subplot(2,4,4); y7=x4*(x3<0)+x1*(x3>0)+x0*(x3==0);
stem(n,y3); subplot(2,4,8);
xlabel('time'); stem(n,y7);
ylabel('amplitude'); xlabel('time');
title('discrete sine function'); ylabel('magnitude');
title('discrete rectangle function');

Name :Tushar Sharma


Roll No. :17EJCEC864
PROGRAM2

PROGRAM CODE

Name :Tushar Sharma


Roll No. :17EJCEC864

You might also like