view m-toolbox/test/make_test_ascii_file.m @ 49:0bcdf74587d1 database-connection-manager

Cleanup
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:36 +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');