필터 지우기
필터 지우기

increasing amplitude of sine wave

조회 수: 1 (최근 30일)
Mohamed Turkmani
Mohamed Turkmani 2022년 9월 1일
댓글: Les Beckham 2022년 9월 1일
hi i want to create i simple sine tone that has increasing amplitude kinda like a fade in 3 seconds
i wrote the following code its just a normal sine tone with Frequency is 3000 hz and amplitude of 1
Fs = 44100;
dt = 1/Fs;
StopTime = 3;
t = (0:dt:StopTime-dt)';
Fc = 3000;
A = 1;
y = A*sin(2*pi*Fc*t);
sound(y,Fs)
how can i make the amplitude start from 0 and inrease linearly to 1 in 3 seconds like a fade?

채택된 답변

Les Beckham
Les Beckham 2022년 9월 1일
Fs = 44100;
dt = 1/Fs;
StopTime = 3;
t = (0:dt:StopTime-dt)';
Fc = 3000;
A = linspace(0, 1, numel(t))';
y = A.*sin(2*pi*Fc*t);
plot(t,y)
grid on
  댓글 수: 2
Mohamed Turkmani
Mohamed Turkmani 2022년 9월 1일
thank you works perfect
Les Beckham
Les Beckham 2022년 9월 1일
You are quite welcome.

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

추가 답변 (1개)

Torsten
Torsten 2022년 9월 1일
y=t/StopTime.*sin(2*pi*Fc*t);
instead of
y = A*sin(2*pi*Fc*t);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by