Generating an example noisy sine wave signal
조회 수: 21 (최근 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!