0% found this document useful (0 votes)
25 views

Programme For The Generation of Unit Impulse Signal

The document contains code to generate and plot various signal sequences: 1) It generates a unit impulse signal as a vector with zeros except for a 1 in the middle. 2) It generates a unit step sequence by getting a value N from the user and creating a vector of ones of length N. 3) It generates a ramp sequence by getting a length from the user and creating a vector from 0 to that length. 4) It generates a sine wave by plotting sine values over an interval of time. 5) It generates a cosine wave by plotting cosine values over an interval of time. 6) It generates an exponential sequence by raising e to the power of indexes in a

Uploaded by

Payal Bhatia
Copyright
© Attribution Non-Commercial (BY-NC)
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)
25 views

Programme For The Generation of Unit Impulse Signal

The document contains code to generate and plot various signal sequences: 1) It generates a unit impulse signal as a vector with zeros except for a 1 in the middle. 2) It generates a unit step sequence by getting a value N from the user and creating a vector of ones of length N. 3) It generates a ramp sequence by getting a length from the user and creating a vector from 0 to that length. 4) It generates a sine wave by plotting sine values over an interval of time. 5) It generates a cosine wave by plotting cosine values over an interval of time. 6) It generates an exponential sequence by raising e to the power of indexes in a

Uploaded by

Payal Bhatia
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 6

Programme for the generation of unit impulse signal-

>> t=-2:1:2;
>> y=[zeros(1,2),ones(1,1),zeros(1,2)];subplot(2,2,1);stem(t,y);
>> ylabel('Amplitude-->');
>> xlabel('(a)n--->');

Fig-unit impulse signal

Programme for the generation of unit step sequence [u(n)-u(n-N)]n=input('enter the N value');
>> t=0:1:n-1;
>> y1=ones(1,n);subplot(2,2,2);
>> stem(t,y1);ylabel('Amplitude-->');
>> xlabel('n-->');

Fig-unit step signal

Programme for the generation of ramp sequence-

n1=input('enter the length of ramp sequence');


>> t=0:n1;
>> subplot(2,2,3);stem(t,t);ylabel('amplitude--->');
>> xlabel('n--->');

Fig-Ramp signal

Programe for generation of sine sequence-

>> t=0:.01:pi;
>> y=sin(2*pi*t);figure(2);
>> subplot(2,2,1);plot(t,y);ylabel('Amplitude -->');
>> xlabel('(a) n -->');
>>

Fig-sine wave signal

Programs for generation of cosine sequence-

>> t=0:0.1:pi;
>> y=cos(2*pi*t);
>> subplot(2,1,1);plot(t,y);ylabel('Amplitude -->');
>> xlabel('(a) n -->');
>>

Fig-cosine wave signal

Programs for the generation of exponential sequence>> n=7


n=
7
>> t=0:n;
>> a=1
a=
1
>> y2=exp(a*t);subplot(2,2,4);
>> stem (t,y2) ; ylabel ('Amplitude -- >') ;
>> xlabel ('n -->');

Fig-Exponential signal

You might also like