From: Greg Heath on 2 Aug 2010 13:30 On Jul 31, 9:31 pm, "Dean " <wj.antis...(a)gmail.com> wrote: > Hi guys, > > I've a signal consists of a frequency 3/32 Hz, sampled at 1 time per second (1 Hz). Since the signal amplitude is 1 volt, I am expecting the signal power is 0.5 v^2. > > Although I can obtain the frequency estimation perfectly, I don't know how to convert Periodogram PSD to the signal amplitude. > > If anyone knows the answer, please kindly let me know. > > Thank you all. > > Dean > > ____ Code as follows ________ -----SNIP You can deduce the relationship from the following demo clear all, close all, clc, p = 0 N = 24 % Not a power of 2 Nfft = 2^nextpow2(N) % 32 T = 3*pi dt = T/N t = dt*(0:N-1)'; t = (0:dt:T-dt)'; t = linspace(0,T-dt,N)'; Fs = 1/dt df = Fs/N f = df*(0:N-1)'; f = (0:df:Fs-dt)'; f = linspace(0,Fs-df,N)'; % Choose f0/df = integer, f0 ~ 0.5*(Fs/2) f0 = round(N/4)*df A0 = 1 x0 = A0*cos(2*pi*f0*t); X0 = fft(x0); absX0 = abs(X0); p=p+1, figure(p) % Note the stem scaling subplot(211) plot(t,x0,'-o') title( 'x0 = A0 *cos( 2 *pi *f0 *t )' ) subplot(212) stem(f,absX0/N,'o') title( ' abs( fft( x0 ) / N )' ) %Power Spectral Density PSD = absX0.^2/(N*Fs); Q = ceil((N+1)/2) % 13 = No. of unique components % Single-Sided PSD fss = f(1:Q); if mod(N,2)==0 % Neven PSDss = [ PSD(1); 2*PSD(2:Q-1); PSD(Q) ]; else % Nodd PSDss = [ PSD(1); 2*PSD(2:Q) ]; end p=p+1, figure(p) subplot(211) stem(f,PSD,'-o') title( 'Doublesided Power Spectral Density' ) subplot(212) stem(fss,PSDss,'-o') title( 'Singlesided Power Spectral Density' ) minmax(PSD') % [1.662e-031 2.3562 ] minmax(PSDss') % [1.8907e-031 4.7124 ] win = rectwin(N); [Pxx,fxx] = periodogram(x0,win,N,Fs); length(fxx) % 13 = 1 + N/2 minmax(fxx') % [0 1.2732 ] minmax(Pxx') % [1.8907e-031 4.7124 ] p=p+1, figure(p) , hold on plot(fxx,Pxx,'k-o') stem(fss,PSDss,'r') legend('periodogram (Nfft = 24)','fft (N = 24)') xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz') title('Single Sided Power Spectral Density') win = rectwin(N); [Pxx,fxx] = periodogram(x0,win,Nfft,Fs); length(fxx) % 17 = 1 + Nfft/2 minmax(fxx') % [0 1.2732 ] minmax(Pxx') % [1.8907e-031 4.7124 ] p=p+1, figure(p) , hold on plot(fxx,Pxx,'k-o') stem(fss,PSDss,'r') legend('periodogram (Nfft = 32)','fft (N = 24)') xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz') title('Single Sided Power Spectral Density') for j=p:-1:1 figure(j) end Hope this helps, Greg
From: Dean on 5 Aug 2010 00:33
Thank you all for your comments and code. Highly appreciated. |