Output of an LTI System through both Fourier transform and Convolution
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Jonas
2022년 5월 24일
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
답변 (1개)
Chandra
2022년 5월 26일
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))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!