Demo entry 6642422

py

   

Submitted by anonymous on Sep 23, 2017 at 11:52
Language: Matlab. Code size: 1.4 kB.

x=[2,4,-3,-1,-5,4,7];
n=[-3:3];
%%------------------------------------------------------
[x11,n11]=sigshift(x,n,3);[x12,n22]=sigshift(x,n,-4);
[x1,n1]=sigadd( 2*x11,n11,3* x12,n22);[x1,n1]=sigadd(x1,n1,-1*x,n);
subplot(2,2,1),stem(n1,x1,'o');xlabel('n1');ylabel('x1(n)');title('x1(n)=2x(n-3)+3x(n+4)-x(n)');
%%---------------------------------------------------------
[x21,n21]=sigshift(x,n,-4);[x22,n22]=sigshift(x,n,-5);
[x2,n2]=sigadd(4*x21,n21,5*x22,n22);[x2,n2]=sigadd(x2,n2,2*x,n);
subplot(2,2,2),stem(n2,x2,'g');xlabel('n2');ylabel('x2(n)');title('x2(n)=4x(4+n)+5x(n+5)+2x(n)');
%%-----------------------------------------------------------
[x311,n311]=sigshift(x,n,-3);
[x312,n312]=sigshift(x,n,2);
[x31,n31]=sigmult(x311,n311,x312,n312);
[x3211,n3211]=sigfold(x,n);[x321,n321]=sigshift(x3211,n3211,1);
[x322,n322]=sigshift(x,n,-1);
[x32,n32]=sigmult(x321,n321,x322,n322);
[x3,n3]=sigadd(x31,n31,x32,n32);
subplot(2,2,3),stem(n3,x3,'b');xlabel('n3');ylabel('x3(n)');title('x3(n)=x(n+3)x(n-2)+x(1-n)x(n+1)');
%%-------------------------------------------------------------
n411=[-10:10];
x411=2*exp(0.5*n411);
[x41,n41]=sigmult(x411,n411,x,n);
n421=[-10:10];x421=cos(0.1*pi*n421);[x422,n422]=sigshift(x,n,-2);
[x42,n42]=sigmult(x421,n421,x422,n422);
[x4,n4]=sigadd(x41,n41,x42,n42);
subplot(2,2,4),stem(n4,x4,'r');xlabel('n4');ylabel('x4(n)');title('x4(n)=2exp(0.5n)*x(n)+cos(0,1πn)x(n+2)')

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).