Professional Documents
Culture Documents
clear
clc
close all
%loop
for h = 1:101
v_t(h) = v * sin(w * t(h));
if system == 1
i_t(h) = v_t(h) / ((r * x_l) / (r + x_l));
p_r(h) = (v_t(h) ^ 2) / r;
elseif system == 2
i_t(h) = v_t(h) / (r + x_l);
p_r(h) = ((abs(i_t(h))) ^ 2) * r;
end
p_s(h) = v_t(h) * i_t(h);
pf = pf + abs(cos(angle(i_t(h))));
p_real = p_real + abs(p_r(h));
end
%calculation
p_avg = p_real / 101; %average real power consumption
pf_avg = pf / 101; %average power factor
%plotting of graphs
%instantaneous resistive load power versus time
figure
plot(t, p_r);
xlabel(‘Time’);
ylabel(‘Instantaneous Resistive Power’);
grid on;
%instantaneous supply power versus time
figure
plot(t, abs(p_s));
xlabel(‘Time’);
ylabel(‘Instantaneous Supply Power’);
grid on;
OUTPUT:
System 1:
System 2:
RESULT:
Thus, the given problem was analysed using MATLAB and the output was recorded.