Five Methods for Discrete Spectrum Correction (MATLAB Code)
1Ratio Correction Method close all; clear all; clc Fs=1024; N=1024; t =(0:N-1)/Fs; tt=0:N-1; hanning=0.5-0.5*cos(2*pi*tt/N); % Hanning window expression x=5.3*cos(2*pi*253.5453*t+240*pi/180); % Function to be analyzed x_hanning=5.3*cos(2*pi*253.5453*t+240*pi/180).*hanning; % Apply Hanning window y = fft(x); yh=fft(x_hanning); Y=y(1:N/2)/N*2; Yh=yh(1:N/2)/N*2; f = Fs/2*linspace(0,1,N/2); A=abs(Y); Ah=abs(Yh); subplot(221); stem(f,A(1:N/2)); title(‘Uncorrected with Rectangular Window’); subplot(222); stem(f,2*Ah(1:N/2)); title(‘Uncorrected with Hanning Window’); % The factor … Read more