t1=-1:0.1:0.5;t2=0.6:0.1:3;t= [t1 t2];x1=0.6.*ones(size(t1));x2=0.3.*ones(size(t2));x=[x1 x2];h=(exp(-t)).*(t>=0);C=length(x)+length(h)-1;X=0;H=0;for i=1: Cc(i) = 0;for j=1:iif(i-j+1>0)c(i)= c(i)+ X(j).* H(i-j+1);elseendendendplot(c)
I'm trying to v=convolve x and h but everytime i run this it gives me the array size error.
I'm using MATLAB Online R2020a, and when I gave this code to someone who had RMATLAB2015a installed on their computer, there was no error.
error is in line 16:
c(i)= c(i)+ X(j).* H(i-j+1);
Best Answer