view m-toolbox/test/make_test_ascii_file.m @ 25:79dc7091dbbc database-connection-manager

Update tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function make_test_ascii_file(name, Nsecs, fs)

% Make a test ascii file with the name 'name.txt' containing a time-series
% of random noise, N seconds long sampled at fs Hz.
% 
% >> make_test_ascii_file(name, Nsecs, fs)
% 
% M Hewitson 01-02-07
% 
% $Id: make_test_ascii_file.m,v 1.3 2007/02/11 19:51:11 hewitson Exp $
% 

% create test data
t   = linspace(0, Nsecs-1/fs, Nsecs*fs);
x   = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t);
out = [t;x].';

% Save data as ascii file
filename = sprintf('%s.txt', name);
save(filename, 'out', '-ASCII', '-DOUBLE', '-TABS');