view m-toolbox/test/test_std.m @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% TEST_STD test std() operator for analysis objects.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: TEST_STD Test std() operator for analysis objects with
%                       tsdata, fsdata cdata and xydata
%
% CALL:    test_std;
%
% HISTORY: 31-05-2007 Diepholz
%             Creation.
%
% VERSION: $Id: test_std.m,v 1.6 2009/08/10 13:50:22 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function test_std()
  
  % Create tsdata with a sinewave
  pl = plist('fs', 100, 'nsecs', 5, 'waveform', 'sine wave', 'f', 1.23, 'phi', 30);
  
  ts_data = ao(pl);
  
  % Create cdata with a 3x3 Matrix
  matr = [1 2 3; 4 5 6; 7 8 9];
  
  c_data = cdata(matr);
  c_data = ao(c_data);
  
  % Create xydata with a exp function
  x = 1:1000;
  y = exp(x.^.5/2);
  
  xy_data = xydata(x,y);
  xy_data = ao(xy_data);
  
  % Some tests
  ao_out = std(ts_data);
  ao_out = std(ts_data, ts_data, ts_data);
  ao_out = std(ts_data, xy_data);
  
  ao_out = std(ts_data, xy_data);
  ao_out = std(ts_data, xy_data);
  
  ao_out = std(c_data, plist('axis', 'y'));
  
  % Create different parameter lists to control the std test
  pl1 = plist('xdata', 't', 'ydata', 'x');
  ao_out = std(ts_data, pl1);
  
  pl2 = plist('xdata', 'x', 'ydata', 'y');
  ao_out = std(xy_data, pl2);
  
  pl3 = plist('xdata', 'x');
  ao_out = std(xy_data, pl3);
  
  pl4 = plist('xdata', 'x');
  ao_out = std(xy_data, pl4);
  
  pl5 = plist('xdata', 'x');
  ao_out = std(xy_data, pl5);
  
  pl6 = plist('ydata', 'y', 'xdata', 'x');
  ao_out = std(xy_data, pl6);
  
end