FFT Transform on vectors

조회 수: 2 (최근 30일)
Cyriac Jose
Cyriac Jose 2018년 9월 5일
편집: Cyriac Jose 2018년 9월 10일
I have a set of 50Hz Voltage and Current values stored as arrays under variable name 'Volt' and 'Cur' sampled at 1000 Hz
Things to be obtained:
1. Extract the 50 Hz component out of the whole load data in turn. Require a sliding window of 20 ms taking the 50 Hz component of the vector for that sliding window and do the fft of that vector and store it in a separate array.
2. Simliary take 50 Hz component of every 20 ms window and store the same to the array.
Can anyone lend a helping hand regarding the same?

답변 (1개)

Naman Chaturvedi
Naman Chaturvedi 2018년 9월 10일
This should help.
For sliding window;
% x=signal
% A=output array
% shift=shift of sliding window
% windowlen=window length
% L=size of signal
A=[];
for i=1:shift:L-windowlen+1
A=[A;abs(fft(x(i:i+windowlen,1)))];
end
For fixed window:
% x=signal
% A=output array
% windowlen=window length
% L=size of signal
A=[];
for i=1:windowlen:L-windowlen+1
A=[A;abs(fft(x(i:i+windowlen,1)))];
end
  댓글 수: 1
Cyriac Jose
Cyriac Jose 2018년 9월 10일
편집: Cyriac Jose 2018년 9월 10일
Thanks for the help Naman! But for each of those sliding window function lets say a sliding window of size 20, we have 20 values to be stored in the array 'A' after each loop iteration. What I want is to have just the 50Hz component out of the 20 fft values in each cycle to be stored in the array 'A'. i.e if the loop is iterated 7 times, the number of elements in my array 'A' should be 7 and not 7*20 elements. Any useful info on the same?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by