Fundamental of power spectral density PSD?

12 views (last 30 days)
,How can specifying the Fundamental?can I take mean value? How can I specifying all other harmonic in this signal ,first ,second harmonic and so on? for this code ?
Fs = 150;
t = 0:1/Fs:1;
x = cos(2*pi*10*t);
%filter from DC component
x=x';
Sig2=x;
w333 =kaiser(151,3.5); %windowing by kaiser window
Sig2 = Sig2.*w333;
SigDFT = fft(Sig2,512);
SigDFT = SigDFT(1:257);
plot(abs(SigDFT))
plot(Sig2); grid on;

Accepted Answer

Wayne King
Wayne King on 28 Dec 2013
Are these two peaks harmonically related? In other words, is the second peak an integer multiple of the first peak. In that case, it is customary to call the lower frequency peak the fundamental and subsequent integer multiples of that peak are the higher harmonics.
  5 Comments
Wayne King
Wayne King on 28 Dec 2013
And I need to know how you obtained that PSD estimate. In other words, what is the sampling frequency of the time data, show the MATLAB code you used, without that information nobody knows what the physical frequencies are.
Mary Jon
Mary Jon on 28 Dec 2013
Edited: Mary Jon on 28 Dec 2013
this is code
%c1 particle size=2hy,2hx---d=1hy---tc=4-----permittivity=4
c1=[3.4579e-016 3.455e-016 3.4588e-016 3.4646e-016 3.4707e-016 3.4754e-016 3.4788e-016 3.4811e-016 3.4828e-016 3.4837e-016 3.4836e-016 3.4818e-016 3.4783e-016 3.4744e-016 3.4715e-016 3.4701e-016 3.4701e-016 3.4715e-016 3.4744e-016 3.4783e-016 3.4818e-016 3.4836e-016 3.4837e-016 3.4828e-016 3.4811e-016 3.4788e-016 3.4754e-016 3.4707e-016 3.4646e-016 3.4588e-016 3.455e-016 3.4579e-016];
A=sum(c1);
AVE1=A/32;
w=c1-AVE1; %filter from DC component
w=w'
Sig2=w;
w333 =kaiser(32,3.5); %windowing by kaiser window
Sig2 = Sig2.*w333;
SigDFT2 = abs(fft(Sig2,512).^2); %FFT &PSD
SigDFT33=circshift(SigDFT2 ,size(SigDFT2 ,1)/2+1)
plot(SigDFT33);

Sign in to comment.

More Answers (2)

Wayne King
Wayne King on 28 Dec 2013
Edited: Wayne King on 28 Dec 2013
The answer is you are only seeing one peak in your signal. When you obtain a two-sided (negative and positive frequencies) PSD estimate of a real-valued signal, each real-valued sine wave results in two peaks (it is a sum or difference of two complex exponentials).
You can remove this redundancy by just retaining one side, which I show you how to do below.
A=sum(c1);
AVE1=A/32;
w=c1-AVE1; %filter from DC component
w=w';
Sig2=w;
w333 =kaiser(32,3.5); %windowing by kaiser window
Sig2 = Sig2.*w333;
SigDFT = fft(Sig2,512);
SigDFT = SigDFT(1:257);
plot(abs(SigDFT))
Now to determine the physical frequency corresponding to that peak, you must tell me what the sampling frequency or sampling interval is. For each pair of elements in your signal, cl, what is the separation between them in time or space?
You can clearly see just by plotting the "time" signal
plot(Sig2); grid on;
That the period is about 12 samples, but without knowing the difference between those samples, nobody can tell what that frequency is other than saying it's about 1 cycle per 12 samples.
  5 Comments
Wayne King
Wayne King on 28 Dec 2013
There really doesn't appear to be other harmonics present, but do you have the Signal Processing Toolbox? If so there is a function for that thd()
Mary Jon
Mary Jon on 29 Dec 2013
for this code ,how calculat the harmonic?
Fs = 150;
t = 0:1/Fs:1;
x = cos(2*pi*10*t);
%filter from DC component
x=x';
Sig2=x;
w333 =kaiser(151,3.5); %windowing by kaiser window
Sig2 = Sig2.*w333;
SigDFT = fft(Sig2,512);
SigDFT = SigDFT(1:257);
plot(abs(SigDFT))
plot(Sig2); grid on;

Sign in to comment.


Wayne King
Wayne King on 29 Dec 2013
Edited: Wayne King on 29 Dec 2013
There is only one sine wave in this signal. There are no harmonics.
Fs = 150;
t = 0:1/Fs:1;
x = cos(2*pi*10*t);
%filter from DC component
x=x';
Sig2=x;
w333 =kaiser(151,3.5); %windowing by kaiser window
Sig2 = Sig2.*w333;
NFFT = 512;
SigDFT = fft(Sig2,NFFT);
SigDFT = SigDFT(1:NFFT/2+1);
plot(abs(SigDFT))
To create a meaningful frequency vector.
df = Fs/NFFT;
freqvec = 0:df:Fs/2;
plot(freqvec,abs(SigDFT))
Now you see in the above plot that the peak is at 10 Hz. This is what I have been trying to tell you. You have to know the sampling frequency.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!