clc 
clear

T = 0:0.01:10; 
Vs = zeros(size(T)); 
VL = zeros(size(T)); 
for i = 1:length(T)
    t = T(i); 
    Vs(i) = 3 * exp(-t/3) * sin(pi * t); 
    if Vs(i) > 0
        VL(i) = Vs(i); 
    else
        VL(i) = 0; 
    end
end

figure;
plot(T, Vs, 'b', 'LineWidth', 1.5); 
hold on;
plot(T, VL, 'r', 'LineWidth', 1.5); 

title('Load Voltage and Supply Voltage of a Half-Wave Rectifier');
xlabel('Time (seconds)');
ylabel('Voltage (V)');
legend('Supply Voltage (Vs)', 'Load Voltage (VL)');
grid on;

clear i t

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: