>> t=0:0.1:5*pi;
>> y=3*sin(t)+rand(1,length(t));
>> plot(t,y)
效果如下所示:
clear;
clc;
N=1000;
Fs=1000;
t=0:(1/Fs):(N-1)*(1/Fs);
f=[50 100 150 200 250];
s=zeros(1,N);
for i=1:length(f)
s=s+sin(2*pi*f(i)*t);
end
noise=0.1*randn(1,N);
r=s+noise;
plot(t,r);
t=0:.1:10;
y=3*sin(t)+rand(1,length(t));
plot(y)