Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

MATLAB PROGRAM to find the Electrical Parameters

MATLAB PROGRAM TO CALCULATE POWER FACTOR, POWER, VOLTAGE AND CURRENT 


clc;
close all;
clc;
% Power and Power Factor Calculations using Matlab
T = 2*pi/(120*pi); % Sine Wave period (T=2*pi/Omega) where Omega=2*pi*f
x = 0; %Integration Lower Limit for Voltage and Current
y = T; %Integration upper Limit for Voltage and Current
k = 0:0.2:1;
t = k.*y; % Horizontal (x-axis) Scale for one complete cycle (which is from 0 to T=1/f)
% quad command is used to compute integration. Write "help quad" in Maltab GUI for
% detailed understanding
%
vsq = (10*cos(120*pi*t + 60*pi/180)).^2;

% % we just defined the voltage as mentioned in the text
isq = (6*cos(120*pi*t + 30.0*pi/180)).^2;
% This function is used to compute instantaneous power as mentioned in the
% text
it = 6*cos(120*pi*t + 30.0*pi/180);
vt = 10*cos(120*pi*t + 60*pi/180);
pt = it.*vt;
% Calculating Voltage, Current, and Power using Formulas given in text
v_integ = integral('vsq', x, y);   % See the formula in text for computing RMS Voltage
v_rms = integral(v_integ/y);            % RMS Voltage
i_integ = integral('Current1',x,y);     % See the formula in text for computing RMS Current
i_rms = sqrt(i_integ/y);                % RMS Current
p_integ = integral('Inst_pr', x, y);    % See the formula in text for computing Average Power
p_average = p_integ/y;                  % Average Power
power_factor = p_average/(i_rms*v_rms); % See the formula in text for computing Power Factor
 
% Printing the Results
fprintf('Average Power:%f \n',p_average)
fprintf('RMS voltage: %f \n',v_rms)
fprintf('Power Factor %f \n', power_factor)
fprintf('RMS Current %f \n', i_rms)

No comments

Popular Posts

Followers