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

2 Ansichten (letzte 30 Tage)

Antworten (1)

Walter Roberson
Walter Roberson am 7 Jan. 2022
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 Kommentar
Austin Bollinger
Austin Bollinger am 7 Jan. 2022
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by