Generating an example noisy sine wave signal
41 次查看(过去 30 天)
显示 更早的评论
I want to generate a noisy sine wave signal with fs = 16000Hz and performs sampling over the time period from 0 secs to 0.02 secs, for 321 samples in total .
fs = 16000; % sampling frequency
t = 0:1/fs:0.02; % start : time step : end
s1 = 1.00 * sin(2*pi*150 * t); % desired 150 Hz sine wave
s2 = 0.05 * sin(2*pi*3304 * t); % interfering noise (3304 Hz)
s3 = 0.02 * sin(2*pi*4000 * t); % more interfering noise (4000 Hz)
s4 = 0.04 * sin(2*pi*5722 * t); % more interfering noise (5722 Hz)
s5 = 0.07 * sin(2*pi*7302 * t); % more interfering noise (7302 Hz)
sigsum = s1 + s2 + s3 + s4 + s5; % final superposed noisy signal
I also want to use the plot command below to verifymy answer:
plot(t, sigsum)
0 个评论
回答(1 个)
Star Strider
2023-9-15
Try this —
fs = 16000; % sampling frequency
t = 0:1/fs:0.02; % start : time step : end
sigsum = sum([1; 0.05; 0.02; 0.04; 0.07].*sin(2*pi*[150; 3304; 4000; 5722; 7320]*t));
figure
plot(t, sigsum)
grid
xlabel('t')
ylabel('s')
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!