Anda di halaman 1dari 11

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 ________ clear all; close all; clc; N = 10000; Nfft = 2^nextpow2(N); A1 = 1; f1 = 3/32; fs = 1; t = (0:N-1)/fs; x = A1*cos(2*pi*f1*t); win = rectwin(N)'; [Pxx,f] = periodogram(x,win,Nfft,fs); figure; plot(f,Pxx,'k-o'); xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz'); grid on; xlim([0.05,0.15]); Subject: convert periodogram PSD estimation to signal amplitude From: Date: 1 Aug, 2010 03:37:05 Message: 2 of 7 Reply to this message Add author to My Watch List View original format Flag as spam "Dean " <wj.antispam@gmail.com> wrote in message <i32iop$m5r$1@fred.mathworks.com>... > 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 ________ > clear all; close all; clc; > N = 10000; > Nfft = 2^nextpow2(N); > A1 = 1; > f1 = 3/32; > fs = 1; t = (0:N-1)/fs; > x = A1*cos(2*pi*f1*t); > win = rectwin(N)'; > [Pxx,f] = periodogram(x,win,Nfft,fs); > figure; plot(f,Pxx,'k-o'); > xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz'); > grid on; xlim([0.05,0.15]);

My approach would be to 'calibrate' my code by using a signal with known amplitude and frequency. The output from the periodogram will then give you the scaling factor to convert periodgram units to real amplitude. Subject: convert periodogram PSD estimation to signal amplitude From: Wayne King Date: 1 Aug, 2010 10:30:21 Message: 3 of 7 Reply to this message Add author to My Watch List View original format Flag as spam "Dean " <wj.antispam@gmail.com> wrote in message <i32iop$m5r$1@fred.mathworks.com>... > 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 ________ > clear all; close all; clc; > N = 10000; > Nfft = 2^nextpow2(N); > A1 = 1; > f1 = 3/32; > fs = 1; t = (0:N-1)/fs; > x = A1*cos(2*pi*f1*t); > win = rectwin(N)'; > [Pxx,f] = periodogram(x,win,Nfft,fs); > figure; plot(f,Pxx,'k-o'); > xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz'); > grid on; xlim([0.05,0.15]); Hi Dean, You need to scale the periodogram estimate correctly. N = 10000; A1 = 1; f1 = 3/32; fs = 1; t = (0:N-1)/fs; x = A1*cos(2*pi*f1*t); h = spectrum.periodogram('Hamming'); msest = msspectrum(h,x,'Fs',1); plot(msest.Frequencies,msest.Data); Hope that helps, Wayne Subject: convert periodogram PSD estimation to signal amplitude From: Dean Date: 1 Aug, 2010 12:54:05

Message: 4 of 7 Reply to this message Add author to My Watch List View original format Flag as spam "Wayne King" <wmkingty@gmail.com> wrote in message <i33ibt$7th$1@fred.mathworks.com>... > "Dean " <wj.antispam@gmail.com> wrote in message <i32iop$m5r$1@fred.mathworks.com>... > > 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 ________ > > clear all; close all; clc; > > N = 10000; > > Nfft = 2^nextpow2(N); > > A1 = 1; > > f1 = 3/32; > > fs = 1; t = (0:N-1)/fs; > > x = A1*cos(2*pi*f1*t); > > win = rectwin(N)'; > > [Pxx,f] = periodogram(x,win,Nfft,fs); > > figure; plot(f,Pxx,'k-o'); > > xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz'); > > grid on; xlim([0.05,0.15]); > > Hi Dean, You need to scale the periodogram estimate correctly. > > N = 10000; > A1 = 1; > f1 = 3/32; > fs = 1; t = (0:N-1)/fs; > x = A1*cos(2*pi*f1*t);

> h = spectrum.periodogram('Hamming'); > msest = msspectrum(h,x,'Fs',1); > plot(msest.Frequencies,msest.Data); > > Hope that helps, > Wayne Hi Wayne, Thank you for your code, it works perfectly. unfortunately, I've generated many graphs using power spectral density rather than mean-square spectrum. The questions is how can I convert PSD to the signal power/amplitude? Or is it possible at all? Cheers, Dean Subject: convert periodogram PSD estimation to signal amplitude From: Wayne King Date: 1 Aug, 2010 18:18:05 Message: 5 of 7 Reply to this message Add author to My Watch List View original format Flag as spam "Dean " <jiangwei0515@gmail.com> wrote in message <i33qpd$mmp$1@fred.mathworks.com>... > "Wayne King" <wmkingty@gmail.com> wrote in message <i33ibt$7th$1@fred.mathworks.com>... > > "Dean " <wj.antispam@gmail.com> wrote in message <i32iop$m5r$1@fred.mathworks.com>... > > > 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 ________ > > > clear all; close all; clc; > > > N = 10000; > > > Nfft = 2^nextpow2(N); > > > A1 = 1; > > > f1 = 3/32; > > > fs = 1; t = (0:N-1)/fs; > > > x = A1*cos(2*pi*f1*t); > > > win = rectwin(N)'; > > > [Pxx,f] = periodogram(x,win,Nfft,fs); > > > figure; plot(f,Pxx,'k-o'); > > > xlabel('Frequency, Hz'); ylabel('PSD, v^2/Hz'); > > > grid on; xlim([0.05,0.15]); >> > > Hi Dean, You need to scale the periodogram estimate correctly. >> > > N = 10000; > > A1 = 1; > > f1 = 3/32; > > fs = 1; t = (0:N-1)/fs; > > x = A1*cos(2*pi*f1*t); > > h = spectrum.periodogram('Hamming'); > > msest = msspectrum(h,x,'Fs',1); > > plot(msest.Frequencies,msest.Data); >> > > Hope that helps, > > Wayne > > Hi Wayne, > > Thank you for your code, it works perfectly. > > unfortunately, I've generated many graphs using power spectral density rather than meansquare spectrum. The questions is how can I convert PSD to the signal power/amplitude? Or is it possible at all? > > Cheers, > > Dean

Hi Dean, in this case you can do: N = 10000; A1 = 1; f1 = 3/32; fs = 1; t = (0:N-1)/fs; x = A1*cos(2*pi*f1*t); [Pxx,F] = periodogram(x,[],[],1,'twosided'); plot(F,Pxx./length(x)); The power in the two complex exponentials is 1/4. If you want just the one-sided. [Pxx,F] = periodogram(x,[],[],1); plot(F,Pxx./length(x)); In general, if you have discrete spectra like your simple example here, then the msspectrum method is probably the best way. If you use the psd() method, there is an avgpower method for integrating under the PSD. h = spectrum.periodogram('Hamming'); psdest = psd(h,x,'Fs',1); psdest = psd(h,x,'Fs',1); avgpower(psdest) % returns 0.5

Hope that helps, Wayne Subject: convert periodogram PSD estimation to signal amplitude From: Greg Heath Date: 2 Aug, 2010 17:30:04 Message: 6 of 7 Reply to this message Add author to My Watch List View original format Flag as spam On Jul 31, 9:31 pm, "Dean " <wj.antis...@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 Subject: convert periodogram PSD estimation to signal amplitude From: Dean Date: 5 Aug, 2010 04:33:04 Message: 7 of 7 Reply to this message Add author to My Watch List View original format Flag as spam Thank you all for your comments and code. Highly appreciated.
Tags for this Thread

Everyone's Tags:
psd, fft, periodogram

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 psd fft Applied ByDate/Time Dean Dean 31 Jul, 2010 21:34:06 31 Jul, 2010 21:34:06

periodogramDean 31 Jul, 2010 21:34:06 Feed for this Thread Contact us at files@mathworks.com

1994-2012 The MathWorks, Inc. Site Help Patents Trademarks Privacy Policy Preventing Piracy Terms of Use RSS Google+ Facebook Twitter Featured MathWorks.com Topics: New Prod

Anda mungkin juga menyukai