Technical discussion about Matlab and issues related to Digital Signal Processing.
Post a new Thread
help needed , plotting a signal - chriskatsis - Jul 14 10:46:00 2005
Hi everyone,
Just one little question.
I want to plot a signal y (where y is a column of a matrix). The
sampling rate was 500Hz
Is there a way when using the plot command (i.e. plot(y) ) to view
the time (x ax) in seconds and not in sampling points?
Thank you in advance
Christos Katsis

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: help needed , plotting a signal - Juan de Dios Santander Vela - Jul 14 14:24:00 2005
El 14/07/2005, a las 16:46, chriskatsis escribió:
> Just one little question.
> I want to plot a signal y (where y is a column of a matrix). The
> sampling rate was 500Hz
> Is there a way when using the plot command (i.e. plot(y) ) to view
> the time (x ax) in seconds and not in sampling points?
If y is a vector, you can do this:
sf = 500;
t = (1:numel(y))/fs;
plot(t,y);
--
Juan de Dios Santander Vela
Diplomado en CC. Físicas, Ingeniero en Electrónica
Doctorando en Tecnologías Multimedia
Becario Predoctoral del Instituto de Astrofísica de Andalucía
Katharine Hepburn: A veces me pregunto si los hombres y mujeres se
complementan. Quizá deberían vivir puerta con puerta, y hacerse
visitas de vez en cuando.

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: help needed , plotting a signal - Amit Pathania - Jul 14 17:00:00 2005
hi.... all u need to do is find the duration of signal y actually lemme
give u an example
y = sin(2*pi*f*t) where y is a sine wave of duration 5 seconds
taking the sampling rate as 500 hz make a time axis ... since sampling
rate means that u get 1 sample every 1/500 of a sec so ur signal has a
value at 0 sec 1/500 sec 2/500 sec ... just make t = 0:1/500:5 (5 is
duration of signal) and then use
plot(t,y) .. if it gives u an error saying different dimension of data
using plot or something similar .. either change t to t=1/500:1/500:5 or
t=0:1/500:5-1/500
hope this helps
--- chriskatsis <me00526@me00...> wrote:
> Hi everyone,
>
> Just one little question.
> I want to plot a signal y (where y is a column of a matrix). The
> sampling rate was 500Hz
> Is there a way when using the plot command (i.e. plot(y) ) to view
> the time (x ax) in seconds and not in sampling points?
>
> Thank you in advance
>
> Christos Katsis

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: help needed , plotting a signal - V Ravi Chander - Jul 15 0:53:00 2005
fs = 500;
t = 1/fs : 1/fs : (length(y)/fs);
plot(t,y);
> Hi everyone,
>
> Just one little question.
> I want to plot a signal y (where y is a column of a matrix). The
> sampling rate was 500Hz
> Is there a way when using the plot command (i.e. plot(y) ) to view
> the time (x ax) in seconds and not in sampling points?
>
> Thank you in advance
>
> Christos Katsis
--
V Ravi Chander,
Emerging Technologies and Services Group,
Reliance Infocomm Ltd.

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
RE: help needed , plotting a signal - Jeff Winter - Jul 15 6:04:00 2005
Hi Christos,
Simply use:
plot(1:length(y)/Fs,y)
where Fs is your sample frequency.
Jeff
-----Original Message-----
From: matlab@matl... [mailto:matlab@matl...]On Behalf Of
chriskatsis
Sent: 14 July 2005 15:47
To: matlab@matl...
Subject: [matlab] help needed , plotting a signal
Hi everyone,
Just one little question.
I want to plot a signal y (where y is a column of a matrix). The
sampling rate was 500Hz
Is there a way when using the plot command (i.e. plot(y) ) to view
the time (x ax) in seconds and not in sampling points?
Thank you in advance
Christos Katsis

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
RE: help needed , plotting a signal - Amit Pathania - Jul 15 6:21:00 2005
hi .. i dont think jeff's solution wud work .. incase the length of y is
500 ie equal to Fs the plot function wud give an error "vector length
mismatch or something" ...
--- Jeff Winter <jeff.winter@jeff...> wrote:
> Hi Christos,
>
> Simply use:
>
> plot(1:length(y)/Fs,y)
>
> where Fs is your sample frequency.
>
> Jeff
>
> -----Original Message-----
> From: matlab@matl... [mailto:matlab@matl...]On Behalf Of
> chriskatsis
> Sent: 14 July 2005 15:47
> To: matlab@matl...
> Subject: [matlab] help needed , plotting a signal
> Hi everyone,
>
> Just one little question.
> I want to plot a signal y (where y is a column of a matrix). The
> sampling rate was 500Hz
> Is there a way when using the plot command (i.e. plot(y) ) to view
> the time (x ax) in seconds and not in sampling points?
>
> Thank you in advance
>
> Christos Katsis

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
RE: help needed , plotting a signal - Jeff Winter - Jul 15 6:33:00 2005
Hi,
Sorry missed some brackets, should be:
plot((1:length(y))/Fs,y)
Jeff
-----Original Message-----
From: Amit Pathania [mailto:amit_pathania30@amit...]
Sent: 15 July 2005 11:21
To: jeff.winter@jeff...; chriskatsis; matlab@matl...
Subject: RE: [matlab] help needed , plotting a signal
hi .. i dont think jeff's solution wud work .. incase the length of y is
500 ie equal to Fs the plot function wud give an error "vector length
mismatch or something" ...
--- Jeff Winter <jeff.winter@jeff...> wrote:
> Hi Christos,
>
> Simply use:
>
> plot(1:length(y)/Fs,y)
>
> where Fs is your sample frequency.
>
> Jeff
>
> -----Original Message-----
> From: matlab@matl... [mailto:matlab@matl...]On Behalf Of
> chriskatsis
> Sent: 14 July 2005 15:47
> To: matlab@matl...
> Subject: [matlab] help needed , plotting a signal
> Hi everyone,
>
> Just one little question.
> I want to plot a signal y (where y is a column of a matrix). The
> sampling rate was 500Hz
> Is there a way when using the plot command (i.e. plot(y) ) to view
> the time (x ax) in seconds and not in sampling points?
>
> Thank you in advance
>
> Christos Katsis
__________________________________________________
">http://mail.yahoo.com

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: help needed , plotting a signal - fzn bki - Jul 25 1:57:00 2005
[y,fs]=wavread('sound');
L=length(y);
%plot frame in time domain
t=[0:1/fs:(511)/fs]
figure(1);
plot(t,vc),axis tight,xlabel('Time (s)'),grid on;
--- V Ravi Chander <ravichander_vipperla@ravi...>
wrote:
> fs = 500;
> t = 1/fs : 1/fs : (length(y)/fs);
> plot(t,y);
> > Hi everyone,
> >
> > Just one little question.
> > I want to plot a signal y (where y is a column of
> a matrix). The
> > sampling rate was 500Hz
> > Is there a way when using the plot command (i.e.
> plot(y) ) to view
> > the time (x ax) in seconds and not in sampling
> points?
> >
> >
> >
> > Thank you in advance
> >
> >
> >
> > Christos Katsis
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> V Ravi Chander,
> Emerging Technologies and Services Group,
> Reliance Infocomm Ltd.
__________________________________________________
">http://mail.yahoo.com

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )