필터 지우기
필터 지우기

How to generate a signal with duration and period?

조회 수: 7 (최근 30일)
maruljay
maruljay 2020년 4월 27일
댓글: Ameer Hamza 2020년 4월 28일
I want to generate a signal using the function: (sin(2π/u)T +1), taken at t = 0, 1, 2, . . . 32sec with u = 32 sec and repeated every 128 seconds.
A noise with the variance of 0.01 also needs to be added to the signal.
The signal should look like this:

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 27일
I guess you made a mistake will writing the equation of periodic function. (sin(2π/u)T +1) canot create such a signal. Try the following code
duration = 32;
period = 128;
u = 32;
T = 0:32;
one_cycle = [sin(pi/u*T) zeros(1, period-numel(T))]+1;
num_cycles = 5;
signal = repmat(one_cycle, 1, num_cycles);
noisy_signal = signal + randn(1, numel(signal))*0.1; % noise with variance 0.1
T = 0:numel(noisy_signal)-1;
subplot(2,1,1);
plot(T, signal);
subplot(2,1,2);
plot(T, noisy_signal);
  댓글 수: 2
maruljay
maruljay 2020년 4월 28일
Thank you so much! Worked like a charm.
Ameer Hamza
Ameer Hamza 2020년 4월 28일
Glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by