Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Half wave rectification :

l=linspace(0,10,100);

sig=sin(2*pi*50*l);
subplot(211)
plot(sig);
grid
% u=1:9;
% t=(1:)
for t=1:100

if sin(2*pi*50*l(t))<=0
sig(t)=0;
else
sig(t) = sin(2*pi*50*l(t));
end
end
subplot(212)
plot(sig);
grid

Full wave rectification :

t=(0:1/10000:0.3);

A= 5;
f=50; % 50 hz freq
sig=A*sin(2*pi*50*t); % sin wave of 0.3 sec, 50 Hz, and 5v amplitude
subplot(211)
plot(sig);
grid
u=1:9;
for l=1:3000 % checking for all 0.3*10000 samples
%
if sin(2*pi*50*t(l))<=0
sig(l)= -A*sin(2*pi*50*t(l));
else
sig(l) = A*sin(2*pi*50*t(l));
end
end
subplot(212)
plot(sig);
grid

You might also like