Consider the below given discrete signal which has been gathered via sampling of an analog current waveform with sampling period $T_s=100\,\mu s$.
I would like to evaluate the RMS value of its first order harmonic which has the frequency $f=58\,Hz$.
This task can be basically divided into two subtasks:
- Finding the first order harmonic
- Evaluating the RMS value
My question is whether I can use the below given formulas for finding the phasor of the first order harmonic ($N=f_s/f$):
$$A_1 = \sum_{k=0}^{N-1} i(k)\cdot \cos\left(\frac{2\pi}{N}\cdot k\right)$$ $$B_1 = -\sum_{k=0}^{N-1} i(k)\cdot \sin\left(\frac{2\pi}{N}\cdot k\right)$$ $$I_1 = \sqrt{A_1^2 + B_1^2}$$ $$\phi_1 = \arctan\left(\frac{B_1}{A_1}\right)$$
My doubts arises from the fact that in my situation $N=\frac{f_s}{f} = \frac{10^4}{58} \approx 172.4$
I have used the below given Scilab code for calculation of the $A_1$ and $B_1$ (supposing that the samples of the current are stored in the vector i_u)
N = 4096;
T = 1/58;
Ts = 0.0001;
M = round(T/Ts);
A1 = 0;
B1 = 0;
for k = 1:N
A1 = A1 + i_u(k)*cos(2*%pi/M*(k-1));
B1 = -(B1 + i_u(k)*sin(2*%pi/M*(k-1)));
end
This piece of my code calculated following values: $A_1 = - 85287.936$ and $B_1 = - 67.218679$ which don't make sense for me.