want to remove extra data in fft data set

조회 수: 1 (최근 30일)
Ambesh
Ambesh 2024년 2월 8일
답변: Pooja Kumari 2024년 2월 8일
i have a current and diffrentioan dat form of magnetic field. those have some extra unwanted error in them. so by doing fft i wnat to remove them.

답변 (1개)

Pooja Kumari
Pooja Kumari 2024년 2월 8일
Hello ambesh,
I think you wanted to remove the extra unwanted error by using fft function.
You can refer to the below code for your reference:
% Assuming you have your current and differential data in vectors
current_data = []; % Your current data
diff_data = []; % Your differential data
% Perform FFT
current_fft = fft(current_data);
diff_fft = fft(diff_data);
% Determine the frequencies for each bin
n = length(current_data); % Assuming current and diff data are the same length
Fs = 1000; % Your data's sample rate in Hz
freqs = (0:n-1)*(Fs/n);
% Apply filter by setting unwanted frequencies to zero
cutoff_frequency = 50; % I have taken Low-pass filter
% Create a mask for frequencies that are within the desired range
mask = (freqs < cutoff_frequency) | (freqs > (Fs - cutoff_frequency)); % Low-pass filter mask
% Apply the mask to the FFT data by element-wise multiplication
filtered_current_fft = current_fft .* mask;
filtered_diff_fft = diff_fft .* mask;
% Perform the inverse FFT to get the cleaned up signal
cleaned_current_data = real(ifft(filtered_current_fft));
cleaned_diff_data = real(ifft(filtered_diff_fft));
You can refer to the following documentation for more information on fft function:

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by