amplitude = load('amplitude.dat');
time = (0:length(amplitude)-1) * Ts;
P1(2:end-1) = 2 * P1(2:end-1);
PSD = (1 / (Fs * L)) * (abs(Y(1:L/2+1)).^2);
PSD(2:end-1) = 2 * PSD(2:end-1);
plot(f, 10 * log10(PSD));
title('Power Spectrum Density');
xlabel('Frequency (Hz)');
ylabel('Power/Frequency (dB/Hz)');
Notes
- Sampling Frequency (Fs): Ensure that you know the correct sampling frequency of your data. If it is not 1000 Hz, replace Fs = 1000 with the correct value.
- Units: The PSD is plotted in decibels (dB/Hz). The conversion is done using 10 * log10(PSD).
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.