🔒 Closed Pwede pa help po sa NUMERADE badly needed for assignment huhu.

Status
Not open for further replies.
Sure, here's a MATLAB code that will plot the voltage across the resistor vR and the voltage of the source vs as a function of time for 0 t 70 ms. The resistance of the load is 1,800 , the voltage source vo = 12V, and f = 60 Hz. The code will also execute twice, once with C=45F and once with C=10 F to examine the effect of capacitor size on the voltage across the load:

Code:
% Define constants
R = 1800;
vo = 12;
f = 60;
w = 2 * pi * f;

% Define time range
t = linspace(0, 0.07, 1000);

% Define capacitor values
C1 = 45e-6;
C2 = 10e-6;

% Calculate voltage across load for C1
vc1 = zeros(size(t));
for n = 1:length(t)
    if (mod(t(n), 1/f) < (1/(2*f)))
        vc1(n) = vo * (1 - exp(-t(n)/(R*C1)));
    else
        vc1(n) = vo * exp(-(t(n) - 1/(2*f))/(R*C1)) * sin(w * (t(n) - 1/(2*f)));
    end
end
vr1 = vc1;

% Calculate voltage across load for C2
vc2 = zeros(size(t));
for n = 1:length(t)
    if (mod(t(n), 1/f) < (1/(2*f)))
        vc2(n) = vo * (1 - exp(-t(n)/(R*C2)));
    else
        vc2(n) = vo * exp(-(t(n) - 1/(2*f))/(R*C2)) * sin(w * (t(n) - 1/(2*f)));
    end
end
vr2 = vc2;

% Plot results
figure;
subplot(2,1,1);
plot(t, vo * sin(w * t), 'b', t, vr1, 'r', t, vr2, 'g');
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Voltage Across Resistor vs. Time');
legend('Source Voltage', 'C=45F', 'C=10F');
subplot(2,1,2);
plot(t, vc1, 'r', t, vc2, 'g');
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Voltage Across Capacitor vs. Time');
legend('C=45F', 'C=10F');

Hope this helps! Let me know if you have any questions.
 
Sure, here's a MATLAB code that will plot the voltage across the resistor vR and the voltage of the source vs as a function of time for 0 t 70 ms. The resistance of the load is 1,800 , the voltage source vo = 12V, and f = 60 Hz. The code will also execute twice, once with C=45F and once with C=10 F to examine the effect of capacitor size on the voltage across the load:

Code:
% Define constants
R = 1800;
vo = 12;
f = 60;
w = 2 * pi * f;

% Define time range
t = linspace(0, 0.07, 1000);

% Define capacitor values
C1 = 45e-6;
C2 = 10e-6;

% Calculate voltage across load for C1
vc1 = zeros(size(t));
for n = 1:length(t)
    if (mod(t(n), 1/f) < (1/(2*f)))
        vc1(n) = vo * (1 - exp(-t(n)/(R*C1)));
    else
        vc1(n) = vo * exp(-(t(n) - 1/(2*f))/(R*C1)) * sin(w * (t(n) - 1/(2*f)));
    end
end
vr1 = vc1;

% Calculate voltage across load for C2
vc2 = zeros(size(t));
for n = 1:length(t)
    if (mod(t(n), 1/f) < (1/(2*f)))
        vc2(n) = vo * (1 - exp(-t(n)/(R*C2)));
    else
        vc2(n) = vo * exp(-(t(n) - 1/(2*f))/(R*C2)) * sin(w * (t(n) - 1/(2*f)));
    end
end
vr2 = vc2;

% Plot results
figure;
subplot(2,1,1);
plot(t, vo * sin(w * t), 'b', t, vr1, 'r', t, vr2, 'g');
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Voltage Across Resistor vs. Time');
legend('Source Voltage', 'C=45F', 'C=10F');
subplot(2,1,2);
plot(t, vc1, 'r', t, vc2, 'g');
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Voltage Across Capacitor vs. Time');
legend('C=45F', 'C=10F');

Hope this helps! Let me know if you have any questions.
thank you so much huhu pagpray nalang po kita
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 453
    Views
  • 1
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
1,092
Guests online
1,175
Total visitors
2,267

Forum statistics

Threads
2,273,809
Posts
28,951,896
Members
1,234,967
Latest member
hunterzz007
Back
Top