how to calculate mean of power spectrum
19 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
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!
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!