Thread Subject: Plotting unit impulse

Subject: Plotting unit impulse

From: Matthew

Date: 13 Mar, 2008 20:43:02

Message: 1 of 4

I am working with transfer functions that undergo unit
impulse forces. I don't know how to plot the actual
impulse force itself. I created the M-file below. I can
plot the displacement and velocity. I want to know how to
show the impulse spike on the same graph though. Can
anybody help?

t=0:.02:20
num1=[1]
num2=[1 0]
denum=[.2 .2 6]
sys1=tf(num1,denum)
sys2=tf(num2, denum)
xt=impulse(sys1,t)
xdott=impulse(sys2,t)
plot(t,xt,'r',t,xdott,'b')

Thanks,
M Ridzon

Subject: Plotting unit impulse

From: Oskar Vivero

Date: 21 May, 2008 17:52:02

Message: 2 of 4

"Matthew " <m_ridzon@hotmail.com> wrote in message
<frc3km$983$1@fred.mathworks.com>...
> I am working with transfer functions that undergo unit
> impulse forces. I don't know how to plot the actual
> impulse force itself. I created the M-file below. I can
> plot the displacement and velocity. I want to know how to
> show the impulse spike on the same graph though. Can
> anybody help?
>
> t=0:.02:20
> num1=[1]
> num2=[1 0]
> denum=[.2 .2 6]
> sys1=tf(num1,denum)
> sys2=tf(num2, denum)
> xt=impulse(sys1,t)
> xdott=impulse(sys2,t)
> plot(t,xt,'r',t,xdott,'b')
>
> Thanks,
> M Ridzon

Hey, you might of found the answer for this, but here is an
idea. Since matlab's IMPULSE is a unit impulse response all
you really need is a vector of values of length(t) which
it's first value is one, example:

imp=zeros(size(t));
imp(1)=1;

then to place it on your plot:
hold on
stem(t,imp)
hold off

Subject: Plotting unit impulse

From: someone

Date: 21 May, 2008 18:08:01

Message: 3 of 4

"Matthew " <m_ridzon@hotmail.com> wrote in message
<frc3km$983$1@fred.mathworks.com>...
> I am working with transfer functions that undergo unit
> impulse forces. I don't know how to plot the actual
> impulse force itself. I created the M-file below. I can
> plot the displacement and velocity. I want to know how
to
> show the impulse spike on the same graph though. Can
> anybody help?
>
> t=0:.02:20
> num1=[1]
> num2=[1 0]
> denum=[.2 .2 6]
> sys1=tf(num1,denum)
> sys2=tf(num2, denum)
> xt=impulse(sys1,t)
> xdott=impulse(sys2,t)
> plot(t,xt,'r',t,xdott,'b')
>

doc stem

% If you don't like the circle on top of the line,
% use the LineSpec property to change or remove it.
> Thanks,
> M Ridzon

Subject: Plotting unit impulse

From: PinkLab

Date: 8 Oct, 2009 15:40:06

Message: 4 of 4

Do you have any idea how to create an impulse manually without using impulse function? like manually draw the impulse?


"Oskar Vivero" <oskar.vivero.nospam@gmail.com> wrote in message <g11ng2$4r9$1@fred.mathworks.com>...
> "Matthew " <m_ridzon@hotmail.com> wrote in message
> <frc3km$983$1@fred.mathworks.com>...
> > I am working with transfer functions that undergo unit
> > impulse forces. I don't know how to plot the actual
> > impulse force itself. I created the M-file below. I can
> > plot the displacement and velocity. I want to know how to
> > show the impulse spike on the same graph though. Can
> > anybody help?
> >
> > t=0:.02:20
> > num1=[1]
> > num2=[1 0]
> > denum=[.2 .2 6]
> > sys1=tf(num1,denum)
> > sys2=tf(num2, denum)
> > xt=impulse(sys1,t)
> > xdott=impulse(sys2,t)
> > plot(t,xt,'r',t,xdott,'b')
> >
> > Thanks,
> > M Ridzon
>
> Hey, you might of found the answer for this, but here is an
> idea. Since matlab's IMPULSE is a unit impulse response all
> you really need is a vector of values of length(t) which
> it's first value is one, example:
>
> imp=zeros(size(t));
> imp(1)=1;
>
> then to place it on your plot:
> hold on
> stem(t,imp)
> hold off

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
stem someone 21 May, 2008 14:10:20
control systems Oskar Vivero 21 May, 2008 13:55:16
impulse response Oskar Vivero 21 May, 2008 13:55:16
unit impulse Matthew 13 Mar, 2008 16:45:05
rssFeed for this Thread

Contact us at files@mathworks.com