Generating an example noisy sine wave signal

56 views (last 30 days)
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)

Answers (1)

Star Strider
Star Strider on 15 Sep 2023
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')
.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!