'PSD of segments using Welch Method MATLAB
I am trying to calculate the average Power spectral density of the segments from a time series using MATLAB. I am just able to get the PSD for each segment but I can't get the average one and plot the graph PSD over Hz. Here is my code:
x = importdata('x.txt'); %time series
Nx = length(x); %number of samples
Ts = 10; %time step in s
Nx = Nx/Ts; %number of samples in one second
fs = 1/Nx; %sample rate
winSize = 1000; %samples in one segment
overlap = floor(winSize/2); %0.5 overlapping
fftSize = winSize;
[S,F,T,PS] = spectrogram(x,winSize,overlap,fftSize,fs)
Thank you very much for the help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
