Path: news.mathworks.com!not-for-mail
From: "Malcom Smith" <jreal_kko@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: To zero pad a signal using MATLAB
Date: Mon, 25 May 2009 18:07:01 +0000 (UTC)
Organization: University of Bolton
Lines: 60
Message-ID: <gvemo5$2g8$1@fred.mathworks.com>
References: <gve9m1$n8d$1@fred.mathworks.com> <gved8f$4p5$1@fred.mathworks.com> <gvedt1$f17$1@fred.mathworks.com> <gveea5$atj$1@fred.mathworks.com>
Reply-To: "Malcom Smith" <jreal_kko@yahoo.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1243274821 2568 172.30.248.38 (25 May 2009 18:07:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 25 May 2009 18:07:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1852358
Xref: news.mathworks.com comp.soft-sys.matlab:542432


Thanks ever so much, Sadik.  It works!  I'm very grateful, indeed.


"Sadik " <sadik.hava@gmail.com> wrote in message <gveea5$atj$1@fred.mathworks.com>...
> I am sorry, it should have been
> 
> plot(0:0.001:0.511,...
> 
> 
> 
> 
> 
> "Sadik " <sadik.hava@gmail.com> wrote in message <gvedt1$f17$1@fred.mathworks.com>...
> > What is z by the way in
> > 
> > plot([t z],...
> > 
> > I believe you had better write like this as I wrote just before your reply:
> > 
> > plot(0:0.001:0.512,...
> > 
> > in that line.
> > 
> > 
> > 
> > "Malcom Smith" <jreal_kko@yahoo.com> wrote in message <gved8f$4p5$1@fred.mathworks.com>...
> > > "Malcom Smith" <jreal_kko@yahoo.com> wrote in message <gve9m1$n8d$1@fred.mathworks.com>...
> > > > Hi there,
> > > > 
> > > > I'm trying to extend the following data set to 512 points by zero padding:
> > > > 
> > > > x(t)=100sin(2*pi*100*t)+2sin(2*pi*184.25*t)+randn(size(t)) where the sampling frequency is 1 kHz and 64 samples are available.  
> > > > 
> > > > Could you please provide me a code for implementing the zero padding and also plotting the resultant signal?
> > > > 
> > > > Many thanks in advance.
> > > 
> > > Please find below the code I have tried  (I'm simply not getting the output I need):
> > > 
> > > figure(10)
> > > subplot(1,2,1);
> > > f1=100;
> > > f2=184.25;
> > > fs=1000;
> > > t1=0;
> > > tstep=(1/fs);
> > > t2=63/fs;
> > > t=[t1:tstep:t2];
> > > x=100*sin(2*pi*f1*t)+2*sin(2*pi*f2*t)+randn(size(t));
> > > y=[x, zeros(1,(511*tstep))]; 
> > > plot([t z],y);
> > > subplot(1,2,2);
> > > Pxx=periodogram(x);
> > > Hpsd = dspdata.psd(Pxx, 'fs',fs);
> > > plot(Hpsd);
> > > datacursormode on
> > > 
> > > Could someone (other than Matt-xys@whatever.com) please help me on this.
> > > 
> > > Many thanks in advance.