<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846</link>
    <title>MATLAB Central Newsreader - generate Time signal from a given PSD</title>
    <description>Feed for thread: generate Time signal from a given PSD</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 03 Nov 2009 15:04:02 -0500</pubDate>
      <title>generate Time signal from a given PSD</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846#691736</link>
      <author>Aymen </author>
      <description>Hello people, &lt;br&gt;
&amp;nbsp;i'm a novice in the field of signal processing and this problem maybe easy for you ...&lt;br&gt;
I want to extract a stochastic time signal from a given PSD using the inverse fourier transform. &lt;br&gt;
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 ).&lt;br&gt;
I think i'm having a scaling problem but i don't know where ...&lt;br&gt;
could you please help me with this :&lt;br&gt;
&lt;br&gt;
First of all i tried to generate random phases for my PSD-amplitudes to be able to perform the ifft.&lt;br&gt;
M=[freq Amplitude];  %PSD Matrix&lt;br&gt;
a=sqrt(Amplitude);&lt;br&gt;
phase = 2*pi*rand(size(a)); %random phases in [0  2*pi]&lt;br&gt;
Y=a.*exp(j*phase);  % complex vector for ifft&lt;br&gt;
&lt;br&gt;
signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????&lt;br&gt;
t=0:35/(N-1):35; %time vector&lt;br&gt;
plot(t,real(signal)) %plot of time signal&lt;br&gt;
&lt;br&gt;
my time vector sould have 179200 values between 0 sec and 35 sec&lt;br&gt;
&lt;br&gt;
which N should i use to get the correct answer ?&lt;br&gt;
&amp;nbsp;</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 18:51:51 -0500</pubDate>
      <title>Re: generate Time signal from a given PSD</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846#691800</link>
      <author>TideMan</author>
      <description>On Nov 4, 4:04&#160;am, &quot;Aymen &quot; &amp;lt;aymenkoo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hello people,&lt;br&gt;
&amp;gt; &#160;i'm a novice in the field of signal processing and this problem maybe easy for you ...&lt;br&gt;
&amp;gt; I want to extract a stochastic time signal from a given PSD using the inverse fourier transform.&lt;br&gt;
&amp;gt; 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 ).&lt;br&gt;
&amp;gt; I think i'm having a scaling problem but i don't know where ...&lt;br&gt;
&amp;gt; could you please help me with this :&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; First of all i tried to generate random phases for my PSD-amplitudes to be able to perform the ifft.&lt;br&gt;
&amp;gt; M=[freq Amplitude]; &#160;%PSD Matrix&lt;br&gt;
&amp;gt; a=sqrt(Amplitude);&lt;br&gt;
&amp;gt; phase = 2*pi*rand(size(a)); %random phases in [0 &#160;2*pi]&lt;br&gt;
&amp;gt; Y=a.*exp(j*phase); &#160;% complex vector for ifft&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????&lt;br&gt;
&amp;gt; t=0:35/(N-1):35; %time vector&lt;br&gt;
&amp;gt; plot(t,real(signal)) %plot of time signal&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; my time vector sould have 179200 values between 0 sec and 35 sec&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; which N should i use to get the correct answer ?&lt;br&gt;
&lt;br&gt;
Why haven't you followed the instructions I gave you here:&lt;br&gt;
&lt;a href=&quot;http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/daa041121df922ea/7ea8124eb997d9c3#7ea8124eb997d9c3&quot;&gt;http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/daa041121df922ea/7ea8124eb997d9c3#7ea8124eb997d9c3&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
I told you how to build Y, but you haven't done that.&lt;br&gt;
Why not?</description>
    </item>
    <item>
      <pubDate>Wed, 04 Nov 2009 07:48:03 -0500</pubDate>
      <title>Re: generate Time signal from a given PSD</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846#691950</link>
      <author>Aymen </author>
      <description>TideMan &amp;lt;mulgor@gmail.com&amp;gt; wrote in message &amp;lt;4fa464e4-319c-4c19-8493-2d46c075cdf2@m3g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Nov 4, 4:04?am, &quot;Aymen &quot; &amp;lt;aymenkoo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hello people,&lt;br&gt;
&amp;gt; &amp;gt; ?i'm a novice in the field of signal processing and this problem maybe easy for you ...&lt;br&gt;
&amp;gt; &amp;gt; I want to extract a stochastic time signal from a given PSD using the inverse fourier transform.&lt;br&gt;
&amp;gt; &amp;gt; 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 ).&lt;br&gt;
&amp;gt; &amp;gt; I think i'm having a scaling problem but i don't know where ...&lt;br&gt;
&amp;gt; &amp;gt; could you please help me with this :&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; First of all i tried to generate random phases for my PSD-amplitudes to be able to perform the ifft.&lt;br&gt;
&amp;gt; &amp;gt; M=[freq Amplitude]; ?%PSD Matrix&lt;br&gt;
&amp;gt; &amp;gt; a=sqrt(Amplitude);&lt;br&gt;
&amp;gt; &amp;gt; phase = 2*pi*rand(size(a)); %random phases in [0 ?2*pi]&lt;br&gt;
&amp;gt; &amp;gt; Y=a.*exp(j*phase); ?% complex vector for ifft&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????&lt;br&gt;
&amp;gt; &amp;gt; t=0:35/(N-1):35; %time vector&lt;br&gt;
&amp;gt; &amp;gt; plot(t,real(signal)) %plot of time signal&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; my time vector sould have 179200 values between 0 sec and 35 sec&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; which N should i use to get the correct answer ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why haven't you followed the instructions I gave you here:&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/daa041121df922ea/7ea8124eb997d9c3#7ea8124eb997d9c3&quot;&gt;http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/daa041121df922ea/7ea8124eb997d9c3#7ea8124eb997d9c3&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I told you how to build Y, but you haven't done that.&lt;br&gt;
&amp;gt; Why not?&lt;br&gt;
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... </description>
    </item>
    <item>
      <pubDate>Thu, 05 Nov 2009 02:45:31 -0500</pubDate>
      <title>Re: generate Time signal from a given PSD</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846#692262</link>
      <author>Greg Heath</author>
      <description>On Nov 3, 10:04 am, &quot;Aymen &quot; &amp;lt;aymenkoo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hello people,&lt;br&gt;
&amp;gt;  i'm a novice in the field of signal processing and this problem &amp;gt; maybe easy for you ...&lt;br&gt;
&amp;gt; I want to extract a stochastic time signal from a given PSD using &amp;gt; the inverse fourier transform.&lt;br&gt;
&amp;gt; the PSD contains frequencies from 0 to 2557,5&lt;br&gt;
&lt;br&gt;
If this is a one-sided PSD there are Q = ceil((N+1)/2) measurements&lt;br&gt;
for nonnegative frequencies 0 to (Q-1)*df = (Q-1)*Fs/N.&lt;br&gt;
&lt;br&gt;
If N is even, Q = N/2+1 and&lt;br&gt;
&lt;br&gt;
2557.5 = Fs/2&lt;br&gt;
&lt;br&gt;
&amp;gt; and i'm trying to  generate a time signal corresponding to that&lt;br&gt;
&amp;gt; PSD (it goes over a  time period of 35 sec ).&lt;br&gt;
&lt;br&gt;
35 = (N-1)*dt = (N-1)/Fs&lt;br&gt;
N  = 1 + 35*Fs&lt;br&gt;
N  = 1 + 70*2557.5 = 179026&lt;br&gt;
&lt;br&gt;
&amp;gt; I think i'm having a scaling problem but i don't know where ...&lt;br&gt;
&amp;gt; could you please help me with this :&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; First of all i tried to generate random phases for my&lt;br&gt;
&amp;gt; PSD-amplitudes to be able to perform the ifft.&lt;br&gt;
&amp;gt; M=[freq Amplitude];  %PSD Matrix&lt;br&gt;
&lt;br&gt;
Q = size(M,1)&lt;br&gt;
&lt;br&gt;
&amp;gt; a=sqrt(Amplitude);&lt;br&gt;
&lt;br&gt;
No.&lt;br&gt;
&lt;br&gt;
Must divide the single sided PSD amplitudes A(2:Q-1) by 2&lt;br&gt;
&lt;br&gt;
&amp;gt; phase = 2*pi*rand(size(a)); %random phases in [0  2*pi]&lt;br&gt;
&amp;gt; Y=a.*exp(j*phase);  % complex vector for ifft&lt;br&gt;
&lt;br&gt;
&amp;nbsp;No.&lt;br&gt;
&lt;br&gt;
Only for nonegative frequencies.&lt;br&gt;
Use conjugate symmetry to create the negative spectrum.&lt;br&gt;
&lt;br&gt;
&amp;gt; signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????&lt;br&gt;
&lt;br&gt;
Your Y is single-sided, N is for double-sided&lt;br&gt;
&lt;br&gt;
&amp;gt; t=0:35/(N-1):35; %time vector&lt;br&gt;
&amp;gt; plot(t,real(signal)) %plot of time signal&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; my time vector sould have 179200 values&lt;br&gt;
&lt;br&gt;
I get 179026.&lt;br&gt;
&lt;br&gt;
&amp;gt; between 0 sec and 35 sec&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; which N should i use to get the correct answer ?&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Thu, 05 Nov 2009 07:40:55 -0500</pubDate>
      <title>Re: generate Time signal from a given PSD</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846#692306</link>
      <author>Greg Heath</author>
      <description>On Nov 4, 9:45&#160;pm, Greg Heath &amp;lt;he...@alumni.brown.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; On Nov 3, 10:04 am, &quot;Aymen&quot; &amp;lt;aymenkoo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Hello people,&lt;br&gt;
&amp;gt; &amp;gt; &#160;i'm a novice in the field of signal processing and this problem &amp;gt; maybe easy for you ...&lt;br&gt;
&amp;gt; &amp;gt; I want to extract a stochastic time signal from a given PSD using &amp;gt; the inverse fourier transform.&lt;br&gt;
&amp;gt; &amp;gt; the PSD contains frequencies from 0 to 2557,5&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If this is a one-sided PSD there are Q = ceil((N+1)/2) measurements&lt;br&gt;
&amp;gt; for nonnegative frequencies 0 to (Q-1)*df = (Q-1)*Fs/N.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If N is even, Q = N/2+1 and&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 2557.5 = Fs/2&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; and i'm trying to &#160;generate a time signal corresponding to that&lt;br&gt;
&amp;gt; &amp;gt; PSD (it goes over a &#160;time period of 35 sec ).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 35 = (N-1)*dt = (N-1)/Fs&lt;br&gt;
&amp;gt; N &#160;= 1 + 35*Fs&lt;br&gt;
&amp;gt; N &#160;= 1 + 70*2557.5 = 179026&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I think i'm having a scaling problem but i don't know where ...&lt;br&gt;
&amp;gt; &amp;gt; could you please help me with this :&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; First of all i tried to generate random phases for my&lt;br&gt;
&amp;gt; &amp;gt; PSD-amplitudes to be able to perform the ifft.&lt;br&gt;
&amp;gt; &amp;gt; M=[freq Amplitude]; &#160;%PSD Matrix&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Q = size(M,1)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; a=sqrt(Amplitude);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; No.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Must divide the single sided PSD amplitudes A(2:Q-1) by 2&lt;br&gt;
&lt;br&gt;
PSD2(1:N) = absY(1:N).^2/N   % Doublesided&lt;br&gt;
PSD1(1:Q) = [PSD2(1) 2*PSD2(2:Q-1) PSD2(Q)] %Single-sided&lt;br&gt;
&lt;br&gt;
absY(1) = ...&lt;br&gt;
absY(Q) = ...&lt;br&gt;
absY(2:Q-1) = ...&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; phase = 2*pi*rand(size(a)); %random phases in [0 &#160;2*pi]&lt;br&gt;
&amp;gt; &amp;gt; Y=a.*exp(j*phase); &#160;% complex vector for ifft&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &#160;No.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Only for nonegative frequencies.&lt;br&gt;
&amp;gt; Use conjugate symmetry to create the negative spectrum.&lt;br&gt;
&lt;br&gt;
Y(Q+1:N) =&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; signal = ifft(Y,N); %inverse Fourier Transform, problem in N ??????&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Your Y is single-sided, N is for double-sided&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; t=0:35/(N-1):35; %time vector&lt;br&gt;
&amp;gt; &amp;gt; plot(t,real(signal)) %plot of time signal&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; my time vector sould have 179200 values&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I get 179026.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; between 0 sec and 35 sec&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; which N should i use to get the correct answer ?&lt;br&gt;
&amp;gt;&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 13:18:02 -0500</pubDate>
      <title>Re: generate Time signal from a given PSD</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846#692670</link>
      <author>Aymen </author>
      <description>thanks for your answers !&lt;br&gt;
it helped a lot, i'm having something near to reality :)</description>
    </item>
  </channel>
</rss>

