plot half-wave rectified sine in matlab

% Define the time vector
t = 0:0.01:2*pi;

% Define the half-wave rectified sine wave
y = abs(sin(t));

% Plot the half-wave rectified sine wave
plot(t, y);
xlabel('Time');
ylabel('Amplitude');
title('Half-Wave Rectified Sine Wave');
234 chars
12 lines

This code will plot a half-wave rectified sine wave in MATLAB.

gistlibby LogSnag