To plot the magnitude of xpfq in the frequency range from 2/fs to fs/2, first we need to take the FFT of xpfq. We can use the fft
function in MATLAB to do this.
main.m99 chars3 lines
Next, we need to compute the frequency vector corresponding to the FFT. We can use the linspace
function to create a vector of frequency values spanning from -fs/2 to fs/2, with a length equal to the length of X_fft
.
main.m84 chars3 lines
To get the frequency range from 2/fs to fs/2, we can create a logical index vector for the frequency vector and use it to select the relevant portion of X_fft
.
main.m206 chars4 lines
Finally, we can plot the magnitude of X_fft
in the relevant frequency range using the plot
function.
main.m124 chars5 lines
gistlibby LogSnag