Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!m13g2000vbf.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: generate Time signal from a given PSD
Date: Wed, 4 Nov 2009 18:45:31 -0800 (PST)
Organization: http://groups.google.com
Lines: 61
Message-ID: <d808d7f7-f9ec-4d78-b6eb-314ebcc4ca7d@m13g2000vbf.googlegroups.com>
References: <hcpgp2$7r6$1@fred.mathworks.com>
NNTP-Posting-Host: 69.141.163.135
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1257389131 1059 127.0.0.1 (5 Nov 2009 02:45:31 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 5 Nov 2009 02:45:31 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: m13g2000vbf.googlegroups.com; posting-host=69.141.163.135; 
	posting-account=mUealwkAAACvQrLWvunjg50tRAnsNtJR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
	2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:582593


On Nov 3, 10:04 am, "Aymen " <aymenkoo...@gmail.com> wrote:
> Hello people,
>  i'm a novice in the field of signal processing and this problem > maybe easy for you ...
> I want to extract a stochastic time signal from a given PSD using > the inverse fourier transform.
> the PSD contains frequencies from 0 to 2557,5

If this is a one-sided PSD there are Q = ceil((N+1)/2) measurements
for nonnegative frequencies 0 to (Q-1)*df = (Q-1)*Fs/N.

If N is even, Q = N/2+1 and

2557.5 = Fs/2

> and i'm trying to  generate a time signal corresponding to that
> PSD (it goes over a  time period of 35 sec ).

35 = (N-1)*dt = (N-1)/Fs
N  = 1 + 35*Fs
N  = 1 + 70*2557.5 = 179026

> I think i'm having a scaling problem but i don't know where ...
> could you please help me with this :
>
> First of all i tried to generate random phases for my
> PSD-amplitudes to be able to perform the ifft.
> M=[freq Amplitude];  %PSD Matrix

Q = size(M,1)

> a=sqrt(Amplitude);

No.

Must divide the single sided PSD amplitudes A(2:Q-1) by 2

> phase = 2*pi*rand(size(a)); %random phases in [0  2*pi]
> Y=a.*exp(j*phase);  % complex vector for ifft

 No.

Only for nonegative frequencies.
Use conjugate symmetry to create the negative spectrum.

> signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????

Your Y is single-sided, N is for double-sided

> t=0:35/(N-1):35; %time vector
> plot(t,real(signal)) %plot of time signal
>
> my time vector sould have 179200 values

I get 179026.

> between 0 sec and 35 sec
>
> which N should i use to get the correct answer ?

Hope this helps.

Greg