function Y = testfnx1(X, n, s);

% function Y = testfnx1(X, n, s);
%
% Generate sample (X,Y) test data for exercise M1.
%
% inputs:
%    X  --  an m by k input array
%    n  --  specify an n by k output array
%    s  --  random number generator seed
% 
% Different values for s result in testfnx1 computing a different
% non-linear function; but for the same s, the matrices A and B,
% and the resulting function computed, will always be the same.  
% The default value for s is 42.
%
% output:
%    Y --  an n by k array, a non-linear function of X

if nargin == 2
  s = 42;
end

[m, k] = size(X);
randn('state', s);
A = randn(n, m);
B = randn(n, n);
Y = B*cos(A*X);

