Sir i am traying to implement DFT algoridhm for calculation of phasor magnitude and angle, but it is not working. I have generated arrey of sine wave in code itself so without analog input we can check that it is working or not. Please help
erkngajjar:
Sir i am traying to implement DFT algoridhm for calculation of phasor magnitude and angle, but it is not working. I have generated arrey of sine wave in code itself so without analog input we can check that it is working or not. Please help
This is not an Apple site...
"Sir i am traying to..."
Your a[] waveform and your sin/cos frequency are different, so you're not going to see
anything meaningful, especially as you're not using a sample window function like Blackman or Hanning.
You can only resolve at the same frequency as the signal.
And this is not really a DFT, the transform converts time-domain to frequency-domain
keeping all the information, here you are picking out one complex frequency component.
Sir here the frequency of a[] waveform if 50hz and the frequency of sin/cos terms are also changed to 50 but nothing is happening again.
Also i have tried FFT library but it only gives magnitude with frequency, but my requirement is to take only 50hz signal and calculate its magnitude and phase angle. I want to measure phase angle between voltage and current vector later which is of 50hz.
Also i have prepared a code for taking analog samples withe 3.2kHz sampling frequency so every cycle of sine wave can have 64 samples. Both the codes are attached here with.
Thank you Mr. MarkT, Mr. Jremington and Mr. GarryP for replaying. I am also thankful to all who have tried to help.
Your phasor code is populating a with 325 sin (0.09817 i), then correlating it with sine and cosine of (100π/64) i 100π/64 is very different from 0.9817 100π/64 is also over the Nyquist limit.