Filter löschen
Filter löschen

Output of an LTI System through both Fourier transform and Convolution

7 Ansichten (letzte 30 Tage)
I have an LTI System x(t) and h(t), and i want to get the output twice, one time using Convolution, and another time using Fourier Transform to and compare between them, but the output graphs are not very identical, is there any problem in my code below?
clear all; clc
t=-0:0.001:5;
x = (sign(t - 1) - sign(t - 3))/2; % My Input x(t)
h = (exp(-t)); % My Transfere function h(t)
y1=conv(h,x); %Getting Ouput by convolution
y11=fft(y1); % Doing TF of y(t)
x_w=fft(x); % Doing TF of x(t)
h_w=fft(h); % Doing TF of h(t)
y2=x_w.*h_w; % Getting the output s
subplot(4,1,1)
plot(t,x)
subplot(4,1,2)
plot(t,h)
subplot(4,1,3)
plot(y11)
subplot(4,1,4)
plot(y2)
  1 Kommentar
Jonas
Jonas am 24 Mai 2022
try plotting the abs value of your y11 and y2 to get a clue how and why they are different at the moment. they look more similar than you think right now

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Chandra
Chandra am 26 Mai 2022
Hi,
add zero padding to the signal before converting to frequency domain because it should match the length of convolution signal.
clear all; clc;close all;
t=-0:0.001:5;
figure,
x = (sign(t - 1) - sign(t - 3))/2; % My Input x(t)
h = (exp(-t)); % My Transfere function h(t)
y1=conv(h,x); %Getting Ouput by convolution
y11=fft(y1); % Doing TF of y(t)
%% sectin that need to change%%
x_w=fft([x zeros(1,length(h)-1)]); % Doing TF of x(t) with padding
h_w=fft([h zeros(1,length(x)-1)]); % Doing TF of h(t) with padding
%% section ends%%
y2=x_w.*h_w; % Getting the output s
subplot(4,1,1)
plot(x) % remove t to avoid conflicts when variable lenght of x and h (or) give appropriate length
subplot(4,1,2)
plot(h)
subplot(4,1,3)
plot((y11))
subplot(4,1,4)
plot((y2))
refer to the link for padding zeros.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by