Is there a way to generate a wave that keeps a constant frequency, but varies the amplitude every wave?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/856580/image.jpeg)
0 commentaires
Réponses (1)
Walter Roberson
le 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.
Voir également
Catégories
En savoir plus sur Signal Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!