Problem in performing IFFT

20 次查看(过去 30 天)
I have performed IFFT for converting frequency to time domain and back to frequency domain. I am getting same results also. However in time domain plot, my response should start with zero and I am getting slighly higher value at time zero.
Here is my code:
clear all
close all
clc
a=0.5;eta=0.3;beta=0.025;wb=14.25;
% Define time and frequency axis variables
fs =400; % samples/s
N = 1024; % number of points
dt = 1 / fs; % s, time step
t = (0:N-1)*dt; % s, time axis
df = 1 / N / dt; % Hz, frequency step
f = (-N/2:N/2-1)*df; % Hz, frequency axis
% Define function
y=sin(pi.*a).*eta.*(1+exp(-1i.*pi.*f./eta))./((-f.^2+(2.*1i).*f.*beta+1).*(eta.^2-f.^2));
%plot original signal
figure, plot(f,y),title('Frequency response');ylabel('Response of beam');xlabel('Frequency'); % plot initial time domain signal
%conversion to time domain
y2 = ifft(ifftshift(y));
figure, plot(t,(y2)),title('Time response');ylabel('Response of beam');xlabel('Time');
axis([0 2.5 -0.05 0.05]); % time domain signal after IFFT
%back to original signal
%y3=fftshift(fft(y2));
%figure,plot(f,y3),title('Frequency response');ylabel('Response of beam');xlabel('Frequency');
Any Help is highly appreciated.
Thanks
  3 个评论
Susmita Panda
Susmita Panda 2021-3-31
The function 'y' belongs to response of beam subjected to moving load. So, in response at time zero the displacement should be zero.

请先登录,再进行评论。

采纳的回答

David Goodmanson
David Goodmanson 2021-3-31
编辑:David Goodmanson 2021-3-31
Hi Susmita,
A couple of things going on here. First, it's good to use more points. Use a lot more points. There is no need to go with something as small as 1024 and there is also no need to go with a power of 2, the importance of which, in my opinion, is a myth. I used a nice even million points in the code below.
Second, in the expression for y there is a factor of (eta^2-f.^2) in the denominator. That puts poles at +-eta on the real frequency axis. The path of integration runs right over them, so by implication you are taking the principal value of the integral. The p.v. is the same as the average value of two functions (y3 and y4 below) where the poles are moved slightly off of the real axis in either the plus or minus i direction. The small parameter gamma accomplishes that.
clear all
close all
clc
a=0.5;eta=0.3;beta=0.025;wb=14.25;gamma = 1e-10; % introduce gamma
% Define time and frequency axis variables
fs =400; % samples/s
N = 1e6; % number of points
dt = 1 / fs; % s, time step
t = (0:N-1)*dt; % s, time axis
df = 1 / N / dt; % Hz, frequency step
f = (-N/2:N/2-1)*df; % Hz, frequency axis
% Define function
y3=sin(pi.*a).*eta.*(1+exp(-1i.*pi.*f./eta))./((-f.^2+(2.*1i).*f.*beta+1).*(eta.^2-i*f*gamma-f.^2));
y4=sin(pi.*a).*eta.*(1+exp(-1i.*pi.*f./eta))./((-f.^2+(2.*1i).*f.*beta+1).*(eta.^2+i*f*gamma-f.^2));
y = (y3+y4)/2;
%plot original signal
figure(1)
% plot initial time domain signal
plot(f,y),title('Frequency response');ylabel('Response of beam');xlabel('Frequency');
grid on
%conversion to time domain
y2 = ifft(ifftshift(y));
figure(2)
plot(t,(y2)),title('Time response');ylabel('Response of beam');xlabel('Time');
axis([0 2.5 -0.05 0.05]); % time domain signal after IFFT
grid on
  4 个评论
David Goodmanson
David Goodmanson 2021-4-5
Hi Susmita,
It's an all right procedure to follow when you are using analytic data as in this case. For real data, quite often taking a couple of derivatives in the presence of noise does not work out very well.
You took the gradient of y2 which is based on an array element-by-element difference. Then to get d(y2) / dt you have to divide by dt (assuming all the time steps are equal which is the case here). Same for acceleration.
y2 has a very small imaginary part, which it pays to get rid of.
The time domain is expanded out to see more of the waveform.
%conversion to time domain
% eliminate nuisance imaginary part
y2 = real(ifft(ifftshift(y)));
figure(2)
plot(t,(y2)),title('Time response');ylabel('Response of beam');xlabel('Time');
xlim([0 50]); % time domain signal after IFFT
grid on
v = gradient(y2)/dt;
figure(3)
plot(t,v)
xlim([0 50]); % vel
grid on
a = gradient(v)/dt;
figure(4)
plot(t,a)
xlim([0 50]); % acc
grid on
Susmita Panda
Susmita Panda 2021-5-28
@David Goodmanson Sir please help me out in my next question asked in the forum about IFFT. I really need great help from you this time.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by