problem with IFFT and Convolution
8 views (last 30 days)
Show older comments
I’m having difficulty with executing IFFT and convolution
I want to see the output of a system with an input sine wave x(t) and transfer function H(f). In order to get the output y(t), I used IFFT with the transfer function to convert it from the frequency domain to the time domain. After which I convoluted both h(t) and x(t) to obtain y(t).
However when I plot y(t) I get a distorted signal. Could someone please instruct me as to what I did wrong? Your help would be highly appreciated
%Transfer function (multipathmodel)
f = 0:1*10^6:30*10^6; %frequency of multipathmodel
a = 0+(7.8*10^-10)*f.^1;
l = [200 225]; %length of wire
g = [0.55 0.45];
Vp = 150*10^6;
h = 0;
for i = 1:2
temp = (g(i)*exp(-a.*l(i))).*exp((-f.*j*2*pi)*l(i)/Vp);
h = h + temp;
end
%h is in the frequency domain
%Multipathmodel
d1 = 10*log(abs(h)); %H(f)/dB
d2 = ifft(h); %Impulse response
%sine wave
fo = 3*10^6; %frequency of the sinewave
Fs = 2^nextpow2((fo*10*2)+fo); %samplingrate
Ts = 1/Fs; %sampling time interval
E = 1/fo; %duration of sinewave (t)
t = 0:Ts:E; %xaxis
x = sin(2*pi*fo*t); %sinewave equation
%convolution of sine wave and transfer function
y = conv2(x,d2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot transfer function
figure(1)
subplot(2,1,1)
plot(f,d1)
title('Transfer function of Twopathmodel')
xlabel('frequency')
ylabel('H(f)/dB')
grid on
%plot the sine wave
subplot(2,1,2)
plot(t,x)
title('Sine wave')
xlabel('Time secs')
ylabel('Amplitude')
grid on
%plot the impulse response of the transfer function
figure(2)
t2 = (0:E/(length(d2)-1):E);
plot(t2,d2)
%axis([0 3.5*10^-6 -1 1])
title('Impulse response')
%plot the convolution
t1 = (0:E/(length(y)-1):E);
figure(3)
plot(t1,y)
%axis([0 3.5*10^-6 -1 1])
title('Convolution')
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!