Skip to content

Instantly share code, notes, and snippets.

@MrwanBaghdad
Created April 23, 2016 09:26
Show Gist options
  • Select an option

  • Save MrwanBaghdad/da068035de5234dbb437193d10db27fa to your computer and use it in GitHub Desktop.

Select an option

Save MrwanBaghdad/da068035de5234dbb437193d10db27fa to your computer and use it in GitHub Desktop.
n= -3:3;
x=[2 4 -3 1 -5 4 7];
[y1,n1]= sigshift(n,x,3);
y1=2*y1;
[y2,n2]= sigshift(n,x,-4);
y2= 3*y2;
[y3,n3]= sigadd(n1,y1,n2,y2);
[y3,n3]=sigadd(n3,y3,n,-x);
stem(n3,y3);
hold on;
[x1,n1]= sigshift(n,x,-4);
x1=2*x1;
[x2, n2]= sigshift(n,x,-5);
x2=5*x2;
x3= 2*x;
[a,b]=sigadd(n1,x1,n2,x2,n,x3);
figure;
stem(b,a);
[x1,n1]=sigshift(n,x,-3);
[x2,n2]=sigshift(n,x,2);
[x1,n1]=sigmul(n1,x1,n2,x2);
[x2,n2]=sigshift(-n,x,1);
[x3,n3]=sigshift(n,x,-1);
[x2,n2]=sigmult(n3,x3,n2,x2);
[x1,n1]=sigadd(n1,x1,n2,x2);
figure;
stem(n1,x1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment