Fs = 1000; % 采样率为1000Hz
T = 1/Fs;
L = 1000;
t = (0:L-1)*T;
% 生成3个随机信号
s1 = rand(1,L);
s2 = rand(1,L)*0.5+0.5;
s3 = -rand(1,L)*0.5-0.5;
% 各自乘以不同的频率和相位,组成脑电图信号
f1 = 10;
f2 = 20;
f3 = 30;
phi1 = pi/4;
phi2 = pi/2;
phi3 = pi*3/4;
x = s1.*sin(2*pi*f1*t+phi1) + s2.*sin(2*pi*f2*t+phi2) + s3.*sin(2*pi*f3*t+phi3);
% 绘制信号波形
plot(t,x);
xlabel('Time (s)');
ylabel('Signal amplitude');
title('Random EEG signal');