want to remove extra data in fft data set

3 次查看(过去 30 天)
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