Clear Filters
Clear Filters

how to calculate mean of power spectrum

17 views (last 30 days)
PRAMOD A
PRAMOD A on 20 Jan 2022
Commented: PRAMOD A on 27 Jan 2022
Hi all,
Please explain me how to calculate the mean of power spectrum for the below dataset.
My dataset is long having more than 50,000 rows and two columns(time domain and Fx values)
The data set is attached with this question.
In the dataset first clumn indicates time in seconds and second column indicates force in newton.
So, basically its a time domain signal and need to convert to frequency domain for the calculation of Mean of Power Spectrum, Frequency centroid and Mean square frequency.
Can anyone explain me how to get the above values from the dataset.

Answers (1)

Sourav Karmakar
Sourav Karmakar on 27 Jan 2022
Hey Pramod,
As per my understanding, you want to calculate the mean of power spectrum from the attached dataset.
So, for that first import the data in your MATLAB workspace and then use the following code :
% Calculation of Mean of Power Spectrum
t = Data{:,1}';
Fx = Data{:,2}';
nfft = 2^nextpow2(length(Fx));
Pxx = abs(fft(Fx,nfft)).^2/length(Fx);
Hpsd = dspdata.psd(Pxx(1:length(Pxx)/2));
%plot(Hpsd); %Uncomment it to view the plotting of the power spectrum
meanPSD = mean(Hpsd.Data) %stores the mean of power spectrum
You can refer the documentation of Power spectrum - MATLAB to know more about the other details and functionalities.
These are some useful links to solve the other two:
Hope this helps!
  1 Comment
PRAMOD A
PRAMOD A on 27 Jan 2022
Thank you Team,
I could able to understand your codes and run it.
Can you please write the codes from same data set for calculation
i) Spectral centroid
ii) Mean square frequency
You had provided links for the above but i am not able to get it.
My sincere and humbly request to please send the codes as it will be a great knowledge transfer

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!