How to generate variable sine wave after fixed number of samples

조회 수: 1 (최근 30일)
i have to generate a sine wave increasing its frequency about 50khz after certain periods(like it should generate 25 periods of 50 khz and 25 periods of 100khz and go on...) until 1Mhz. Thanks in Advance

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 2월 21일
np=25
f=50
t=0:T/10:T;
y=sin(2*pi*f*t);
for k=1:19
f=f+50;
T=1/f;
t1=t(end)+T/20:T/20:t(end)+np*T;
y1=sin(2*pi*f*t1);
t=[t t1];
y=[y y1];
end
plot(t,y)
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2016년 2월 21일
T is the period of your sine wave, and yes you can save this signal in a mat file, and use the from file block in simulink
guduguntla sai shankar
guduguntla sai shankar 2016년 3월 6일
Hello sir i have doubt,In the above code sine wave is generated succefully but inbetween frequency change there are some unwanted signals.
what is the possibility to make our sine wave increase its frequency exactly after 20 periods?
Thanks in Advance.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by