Code covered by the BSD License  

Highlights from
FFT analysis of Rectified sine waves

image thumbnail

FFT analysis of Rectified sine waves

by

 

Fourier analysis of simple sine wave of 10Hz with Half and full wave Rectification

HW_FW_FFT_analysis.m
clc
clear
close
%%%%%%%%%% Creating a time vector from 0 to 1 sampled at 100 Hz
fs=100
t=0:1/fs:1;

%%%%%%%Create a sine wave of frequency 10 Hz
f=10
y=sin(f*2*pi*t);
subplot(6,1,1)
plot(t,y)
title('10Hz sine wave')
grid
N=1024;
%%%%%%%%% Compute the N point FFT of the signal
Y=abs(fft(y,N));
%%%%%%%%%%%%%%%Centre at zero
Y=fftshift(Y);
F=[-N/2:N/2-1];
subplot(6,1,2)
F=F/f
plot(F,Y)
title('FFT of the 10Hz signal sampled at 100Hz')
grid
%%%%%%Full-Wave Rectified
n=sin(10*2*pi*t);
%%%%%%%%%%%% Rectifying the 10Hz signal
x=y.*(y>=0)-n.*(n<=0);
subplot(6,1,3)
plot(t,x)
grid
title('Full-Wave Rectified signal')
X=abs(fft(x,N));
X=fftshift(X);
subplot(6,1,4)
plot(F,X)
grid
title('FFT of Full-Wave Rectified signal')
grid
x=y.*(y>=0);
subplot(6,1,5)
plot(t,x)
grid
title('Half-Wave Rectified signal')
X=abs(fft(x,N));
X=fftshift(X);
subplot(6,1,6)
plot(F,X)
title('FFT of Half-Wave Rectified signal')
grid


Contact us