MATLAB: How to generate full wave rectified sine wave

full wave rectifiersimulinksin wave

how to generate full wave rectified sine wave of frequency 2KHz, amplitude +/- 0.2 and duration of 1 millisecond ?

Best Answer

Hello Thar, attach an Abs (for absolute) block from the Math Operations library to the Sine Wave generator (Sources). In the Sine Wave block you can define the signal parameters (frequency, amplitude). 1 ms would be the simulation stop time.
Similarly, in MATLAB,
t = 0:1e-5:1e-3;
y = abs(0.2 * sin(2*pi*2e3*t));
plot(t,y)