Is there a way to generate a wave that keeps a constant frequency, but varies the amplitude every wave?
조회 수: 2 (최근 30일)
이전 댓글 표시
답변 (1개)
Walter Roberson
2022년 1월 7일
Is it possible?
Fs = 4000;
F = 20;
T = 5;
t = (0:(T*Fs-1))/Fs;
x = sin(2*pi*t*F);
x2 = x;
x2(1:end/2) = x2(1:end/2) / 3;
plot(t, x, 'DisplayName', 'original');
hold on
plot(t, x2, 'DisplayName', 'modulated');
hold off
legend show
sound(x, Fs)
sound(0*x(1:floor(end/3)), Fs); %some silence
sound(x2, Fs)
xfft = fft(x);
x2fft = fft(x2);
L = length(x);
F = (0:L/2)/L * Fs;
nF = length(F);
y = abs(xfft(1:nF)); y(1) = 0; y = y./max(y);
y2 = abs(x2fft(1:nF)); y2(1) = 0; y2 = y2./max(y2);
skip = floor(nF/20);
subplot(2,1,1); plot(F(skip:end), y(skip:end), 'DisplayName', 'original'); title('original scaled')
subplot(2,1,2); plot(F(skip:end), y2(skip:end), 'DisplayName', 'modulated'); title('modulated scaled')
The answer, then, is NO:
If you modify the amplitude differently for two different points, then you modify the frequency.
참고 항목
카테고리
Help Center 및 File Exchange에서 Signal Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!