Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- h=[-1, 3, 4, 2]
- x=[1, 3, -1, 2, 5]
- odx = flip(x)
- c1=numel(h)
- c2=numel(odx)
- m=c2;
- n=2;
- p=c1-c2+2;
- u=(c1+c2)-1;
- WE=zeros(1,(c1+c2)-1);
- WY=zeros(1,(c1+c2)-1);
- for i=1:u
- if i <= c1
- for z = 1:i
- WE(z) = [h(1,z)*odx(1,m)];
- m=m+1;
- end
- m=c2-i;
- WY(i)=sum(WE);
- WE=zeros(1,c2);
- end
- if i > c2 && i <=c1
- H=n;
- for z=1:c2
- WE(z)=[h(1,H)*odx(1,z)];
- H=H+1;
- end
- n=n+1;
- WY(i)=sum(WE);
- WE=zeros(1,c2);
- end
- if i > c1
- H=p;
- for z=1:c2-1
- WE(z)=[h(1,H)*odx(1,z)];
- H=H+1;
- end
- p=p+1;
- c2=c2-1;
- WY(i)=sum(WE)
- WE=zeros(1,c2);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement