Path: news.mathworks.com!not-for-mail
From: "Sadik " <sadik.hava@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: To zero pad a signal using MATLAB
Date: Mon, 25 May 2009 15:23:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <gved4l$qm5$1@fred.mathworks.com>
References: <gve9m1$n8d$1@fred.mathworks.com>
Reply-To: "Sadik " <sadik.hava@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1243264981 27333 172.30.248.35 (25 May 2009 15:23:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 25 May 2009 15:23:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1666517
Xref: news.mathworks.com comp.soft-sys.matlab:542394


Your t could be 

t = 0:0.001:0.063

so that your sampling frequency will be 1KHz and you will have 64 samples.

Your signal will then be

x = 100*sin(2*pi*100*t)+2*sin(2*pi*184.25*t)+randn(size(t));

The zero padded signal will be

xZeroPadded = [x zeros(1,512-64)];

Then, you can plot your signal by

plot(t,x)

and 

plot(0:0.001:0.512,xZeroPadded)





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