Below given is a program to generate an impulse signal.

**%program to generate Impulse Signal**

**t=-2:2;**

**y=zeros(1,5);**

**y(1,3)=1;**

**stem(t,y);**

**ylabel ('Amplitude');**

**xlabel ('Time Index');**

**TITLE ('Impulse Signal');**

**Here we have created an array Y with the following data 0,0,1,0,0. When this is compared to the time axis we get '1' for the time zero which represents the impulse signal.**

Try plot(), instead of stem(). You may not get the required result. Guess the reason for it !!!. If you could not make it out ask me.

## 13 comments:

thanks

I just got a triangular shape when Plot() is used .. why ??

is there a program for lightning surge

plot() gives a continous wave signal and marks the whole signal instead of the digital impulse value.

thank u

why y(1,3)=1 is used?? what is its significance? and if we change the value if y it shows error, say i have entered the value y=zeros(1,6) or y=zeros(1,7). can u plz help me.

i think plot is used for plotting continuous function and stem for discrete function.. that's why stem is used here

why we are using y=zeros(1,5) and y(1,3)=1 ?

n=-5:5;

m=2

x1=1*[(n+m)==0] %for impulse at n=-2

stem(n,x1)

y=zeros(1,5); why we are using this line??

for take five zeros in a single row

I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in MATLAB, kindly contact us http://www.maxmunus.com/contact

MaxMunus Offer World Class Virtual Instructor led training on MATLAB. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.

For Demo Contact us.

Nitesh Kumar

MaxMunus

E-mail: nitesh@maxmunus.com

Skype id: nitesh_maxmunus

Ph:(+91) 8553912023

http://www.maxmunus.com/

how do you use the dirac funtion to plot a unit impulse function?

## Post a Comment