How to make this code without using built-in convolution function.
Show older comments
clear all;
clc;
delta_t=0.0001;
t=[-6:delta_t:6];
x=(t>=-2)&(t<=2);
h=((t>=0)&(t<=3)).*((2/3)*t);
y=conv(x, h, 'same')*delta_t;
subplot(3,1,1); plot(t,x,'r'); grid on; ylim([-0.5 2]); ylabel('x(t)')
subplot(3,1,2); plot(t,h,'m'); grid on; ylim([-0.5 3]); ylabel('h(t)')
subplot(3,1,3); plot(t,y,'b'); grid on; ylim([-0.5 4]); ylabel('y(t)')
1 Comment
Paul
on 31 Mar 2024
If you have a license for the Symbolic Math Toolbox, the closed-form expression for y can be obtained using syms, rectangularPulse, and int
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!