LEC 6 Phasor Extraction - Continue - THREE - Sample

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm


Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm

𝑦−1 𝑦0 𝑦1 Three samples 𝑦2


𝑦1
𝑦0
𝑦−1
Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm

𝑦−1 𝑦0 𝑦1 Three samples 𝑦2


𝑦1
𝑦0
𝑦−1
Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm

𝑦2
𝑦1
𝑦0
𝑦−1
Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm

𝑦2
𝑦1
𝑦0
𝑦−1
Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm

𝑦2
𝑦1
𝑦0
𝑦−1
Extracting Phasors of AC Voltage and Current Signals

Three sample algorithm

𝑦2
𝑦1
𝑦0
𝑦−1
Extracting Phasors of AC Voltage and Current Signals

Example
Compute the phasor of the following samples using the three sample
algorithm.
These samples are for 50 Hz signal sampled at 800 Hz.
fo= 50 ; % fundamental frequency
phi= pi/4;

fs= 1600 ; % sampling frequency


delta_t = 1/fs; % sampling time
theta= 2*pi*fo * delta_t ;
indx =1;
for i = 0 : delta_t : 3*(1/fo)
time(indx)= i;
y(indx)= 20 * sin(2*pi*fo*i + phi);

indx = indx +1;


end

figure; plot(time,y)
% two sample algorithm
% total number of samples = 3* fs/ fo
%for n = 2 : 1 : 3*(fs/fo)+1
for n = 3 : 1 : length(y)
yc = y(n-1);
ys = ( y(n-1)*cos(theta)- y(n-2) )/sin(theta);
%yc = y(n);
%ys = ( y(n)*cos(theta)- y(n-1) )/sin(theta);

ypeak2 (n)= sqrt(yc^2 + ys^2);


yphi2 (n)= atan2(yc,ys);
%%%%%%%%%%%%%%%%%%%%%% Three sample algorithm %%%%%%%%%%
a=y(n-2)*cos(theta) + y(n-1) + y(n)*cos(theta) ;
b=2*(cos(theta))^2 + 1;
yc = a/b;
ys = ( y(n)- y(n-2) )/(2*sin(theta));
ypeak3 (n)= sqrt(yc^2 + ys^2);
yphi3 (n)= atan2(yc,ys);
end
figure;plot(time, ypeak2,time, ypeak3,'linewidth',3);grid;legend('two sample','three
sample')
figure;plot(time,yphi2, time, yphi3,'linewidth',3);grid;legend('two sample','three
sample')

You might also like