%%
clear; clc; close all;
nvar = 30; % 变量数
time_period = 1.3736e+07; % 时长(秒)
fs = 99; % 采样率
deltT = 1/fs*1000; % 毫秒
fid=fopen('generate.txt','w');
fprintf(fid,'%-25s','time');
for j = 2:1:nvar
fprintf(fid,'%-25s',['var' num2str(j)]);
end
fprintf(fid, '\n');
for i = 1:1:time_period*fs
fprintf(fid, '%-25s', datestr((i-1) * deltT / (24 * 3600 * 1000), 'HH:MM:SS.FFF') );
for j = 2:1:nvar
fprintf(fid,'%-25.16f',(rand(1)-0.5) * 1 + 3* sin( (i-1) / fs * 2 * pi * (j-1)) + 12*cos((i-1) / fs * 2 * pi * (j-1)*2) + 7*cos((i-1) / fs * 2 * pi * (j-1)*3));
end
fprintf(fid, '\n');
end
fclose(fid);