Is there a way to generate a wave that keeps a constant frequency, but varies the amplitude every wave?

2 次查看(过去 30 天)

回答(1 个)

Walter Roberson
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.
  1 个评论
Austin Bollinger
Austin Bollinger 2022-1-7
Thank you for your in depth review. I am trying to program a 6 degree of freedom device to stay at 0.2hz in heave motion but vary the amplitude so the distance of the movement in heave varies. I'll have to think around this.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Signal Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by