Thread Subject: generate Time signal from a given PSD

Subject: generate Time signal from a given PSD

From: Aymen

Date: 3 Nov, 2009 15:04:02

Message: 1 of 6

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 and i'm trying to generate a time signal corresponding to that PSD (it goes over a time period of 35 sec ).
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
a=sqrt(Amplitude);
phase = 2*pi*rand(size(a)); %random phases in [0 2*pi]
Y=a.*exp(j*phase); % complex vector for ifft

signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????
t=0:35/(N-1):35; %time vector
plot(t,real(signal)) %plot of time signal

my time vector sould have 179200 values between 0 sec and 35 sec

which N should i use to get the correct answer ?
 

Subject: generate Time signal from a given PSD

From: TideMan

Date: 3 Nov, 2009 18:51:51

Message: 2 of 6

On Nov 4, 4: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 and i'm trying to generate a time signal corresponding to that PSD (it goes over a time period of 35 sec ).
> 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
> a=sqrt(Amplitude);
> phase = 2*pi*rand(size(a)); %random phases in [0  2*pi]
> Y=a.*exp(j*phase);  % complex vector for ifft
>
> signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????
> t=0:35/(N-1):35; %time vector
> plot(t,real(signal)) %plot of time signal
>
> my time vector sould have 179200 values between 0 sec and 35 sec
>
> which N should i use to get the correct answer ?

Why haven't you followed the instructions I gave you here:
http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/daa041121df922ea/7ea8124eb997d9c3#7ea8124eb997d9c3

I told you how to build Y, but you haven't done that.
Why not?

Subject: generate Time signal from a given PSD

From: Aymen

Date: 4 Nov, 2009 07:48:03

Message: 3 of 6

TideMan <mulgor@gmail.com> wrote in message <4fa464e4-319c-4c19-8493-2d46c075cdf2@m3g2000pri.googlegroups.com>...
> On Nov 4, 4: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 and i'm trying to generate a time signal corresponding to that PSD (it goes over a time period of 35 sec ).
> > 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
> > a=sqrt(Amplitude);
> > phase = 2*pi*rand(size(a)); %random phases in [0 ?2*pi]
> > Y=a.*exp(j*phase); ?% complex vector for ifft
> >
> > signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????
> > t=0:35/(N-1):35; %time vector
> > plot(t,real(signal)) %plot of time signal
> >
> > my time vector sould have 179200 values between 0 sec and 35 sec
> >
> > which N should i use to get the correct answer ?
>
> Why haven't you followed the instructions I gave you here:
> http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/daa041121df922ea/7ea8124eb997d9c3#7ea8124eb997d9c3
>
> I told you how to build Y, but you haven't done that.
> Why not?
i did it that way first but the signal i got was nearly the same... i must get a signal that is nearly 10^5 times bigger in amplitude than my signal...

Subject: generate Time signal from a given PSD

From: Greg Heath

Date: 5 Nov, 2009 02:45:31

Message: 4 of 6

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

Subject: generate Time signal from a given PSD

From: Greg Heath

Date: 5 Nov, 2009 07:40:55

Message: 5 of 6

On Nov 4, 9:45 pm, Greg Heath <he...@alumni.brown.edu> wrote:
> 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

PSD2(1:N) = absY(1:N).^2/N % Doublesided
PSD1(1:Q) = [PSD2(1) 2*PSD2(2:Q-1) PSD2(Q)] %Single-sided

absY(1) = ...
absY(Q) = ...
absY(2:Q-1) = ...

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

Y(Q+1:N) =

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

Subject: generate Time signal from a given PSD

From: Aymen

Date: 6 Nov, 2009 13:18:02

Message: 6 of 6

thanks for your answers !
it helped a lot, i'm having something near to reality :)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
psd time signal... Aymen 3 Nov, 2009 10:09:02
rssFeed for this Thread

Contact us at files@mathworks.com