逆フーリエ変換(フーリエ逆変換)の関数X = ifft(Y,n)を​使うとnの値によって​振幅の大きさが変わる​のは正しいですか?

12 views (last 30 days)
K_S_
K_S_ on 14 Feb 2024
Answered: Ayush Modi on 20 Feb 2024
フーリエ変換・逆変換初心者です。下記を参考にフーリエ逆変換をしました。
>X = ifft(Y,n) は、長さが n になるように Y の末尾をゼロでパディングして、Y n 点の逆フーリエ変換を返します。
nの値によって振幅が変わるのは正しいのですか?
正しくなければ対策方法を教えていただきたいです。
%% 周波数特性をフーリエ逆変換して時間領域に変換 %%
% パラメータの設定
fs =2e6; % フーリエ逆変換のサンプリング周波数 (Hz)
T = 1/fs; % サンプリング間隔
f_center = 10e3; % 中心周波数 (Hz)
f_width = 2e3; % 三角形の底辺の幅 (Hz)
desired_amplitude = 1; % 望ましいピークの振幅
T_test = 2e-3; %テストデータの周期 [sec]
f_ifft1 = 2e6;
f_ifft2 = 2e5;
f_ifft3 = 2e4;
T_ifft1 = 1/f_ifft1;
T_ifft2 = 1/f_ifft2;
T_ifft3 = 1/f_ifft3;
% 周波数領域での振幅スペクトルの生成
frequencies = 0:1:f_center+f_width; % 0からサンプリング周波数までの周波数を生成
amplitude_spectrum = zeros(1, length(frequencies));
% 二等辺三角形の周波数分布を生成
amplitude_spectrum(abs(frequencies - f_center) <= f_width/2) = desired_amplitude * (1 - 2 * abs((frequencies(abs(frequencies - f_center) <= f_width/2) - f_center) / f_width));
% 時間領域での波形を逆フーリエ変換
time_domain_signal1 = ifft(amplitude_spectrum,f_ifft1,'symmetric');
time_domain_signal2 = ifft(amplitude_spectrum,f_ifft2,'symmetric');
time_domain_signal3 = ifft(amplitude_spectrum,f_ifft3,'symmetric');
% 波形のプロット
figure;
subplot(4,1,1);
plot(frequencies, amplitude_spectrum);
title('Amplitude Spectrum');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
subplot(4,1,2);
t = 0:T_ifft1:(length(time_domain_signal1)-1)*T_ifft1;
plot(t, real(time_domain_signal1));
title('Time Domain Signal1');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(4,1,3);
t = 0:T_ifft2:(length(time_domain_signal2)-1)*T_ifft2;
plot(t, real(time_domain_signal2));
title('Time Domain Signal2');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(4,1,4);
t = 0:T_ifft3:(length(time_domain_signal3)-1)*T_ifft3;
plot(t, real(time_domain_signal3));
title('Time Domain Signal3');
xlabel('Time (s)');
ylabel('Amplitude');

Answers (1)

Ayush Modi
Ayush Modi on 20 Feb 2024
Hello,
私の母国語は日本語ではないので、この質問には英語で答えてみます。ご理解いただきありがとうございます。
"ifft" function calculates the inverse fourier transform (amplitude) based on algorithm mentioned in the below Mathworks documentation:
Consider,
X = ifft(Y,n)
as argument n changes the length of input argument by padding trailing zeros, resulting value, X, also changes based on the algorithm. Therefore, amplitude changes depending on the value of agrument n (i.e. Inverse transform length).
Please refer to the following section of MathWorks documentation for more information on the input arguments of "ifft" function:

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!