title: MATLAB using rand to test for time invariance
body: <p>So I am given a certain system: <code>y(n) = 10x(n)cos(0.25pi*n + 0.1pi)</code></p>
  
  <p>And I am to test if the system is time invariant by plotting two input signals x(n) and x(n-2), and their corresponding output signals. X(n) is supposed to be a causal signal with 10 elements using the rand function.</p>
  
  <p>This is the code I've written thus far:</p>
  
  <pre><code>clear all; clc; close all;
  n = 0:9; n2 = 0:11;                        
  xN1 = [rand(1,10) 0 0];                   %x(n)
  xN2 = [0 0 rand(1,10)];                   %x(n-2)
  yN1 = 10.*xN1.*cos(0.25.*pi.*n2+0.1.*pi); %y(n)
  yN2 = 10.*xN2.*cos(0.25.*pi.*n2+0.1.*pi); %y(n-2)
  
  figure, 
  subplot(2,2,1)
      stem(n2,xN1),title('x1')
  subplot(2,2,2)
      stem(n2,yN1),title('y1')
  subplot(2,2,3)
      stem(n2,xN2),title('x2')
  subplot(2,2,4)
      stem(n2,yN2),title('y2')
  </code></pre>
  
  <p>My question is what am I being asked to plot? x1 vs. x2, and then y1 vs. y2? Or x1 vs. n and x2 vs. n, and so on.</p>
  
  <p>This is the result I obtain with my current code, <a href="http://imgur.com/iho2LDX" rel="nofollow">http://imgur.com/iho2LDX</a>. Does this mean the signal is time variant?</p>