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 15:25:04 +0000 (UTC)
Organization: University of Bolton
Lines: 34
Message-ID: <gved8f$4p5$1@fred.mathworks.com>
References: <gve9m1$n8d$1@fred.mathworks.com>
Reply-To: "Malcom Smith" <jreal_kko@yahoo.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1243265104 4901 172.30.248.37 (25 May 2009 15:25:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 25 May 2009 15:25:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1852358
Xref: news.mathworks.com comp.soft-sys.matlab:542395


"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.