Convolution of two signal

T
Tayfun_celebi · Dec 10, 2021 · 2K views
Question
How can I write the convolution code of the function below?   u(t)=sin(2*pi*f*t) g(t)=exp(-t/tau) Analytically or with con(,) ?
Related Questions
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Aug 16, 2026

Try This:

 

numPoints = 1000; % Whatever.
f = .10; % Whatever.
tau = 2; % Whatever.
t = linspace(0, 4*pi); % Whatever.
u = sin(2*pi*f*t);
g = exp(-t/tau);
out = conv(u, g, 'full');
% Plot u
subplot(3, 1, 1);
plot(t, u, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 12);
ylabel('u', 'FontSize', 12);
% Plot g
subplot(3, 1, 2);
plot(t, g, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 12);
ylabel('g', 'FontSize', 12);
% Plot out
subplot(3, 1, 3);
% plot(t, out, 'b-', 'LineWidth', 2);  % Would need to compute the new t if you want this.
plot(out, 'b-', 'LineWidth', 2);  % Just plot vs. index.
grid on;
xlabel('t', 'FontSize', 12);
ylabel('out', 'FontSize', 12);

% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);

 

Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!