以下函数将生成 FM 调制信号 - 它不如(灵活等)好,fmmod
但如果您没有 Comm System Toolbox,这可能是一个不错的选择。
function [s t] = makeFM( x, Fc, Fs, strength )
% for a signal x that modulates a carrier at frequency Fc
% produce the FM modulated signal
% works for 1 D input only
% no error checking
x = x(:);
% sampling points in time:
t = ( 0 : numel( x ) - 1 )' / Fs;
% integrate input signal
integratedX = cumsum( x ) / Fs;
s = cos( 2 * pi * ( Fc * t + strength * integratedX ));
把它放在你的路径中,并使用与fmmod
函数类似的参数调用它(但没有可选参数):
fc = 5000; %Carrier Frequency
fs = 1000; %Signal Frequency
t = 0:0.00001:0.002;
x = sin( 2*pi*fs*t );
dev = 50;
subplot(2,1,1);
plot(t,x);
y = makeFM(x, fc, 2.5*fc, dev); % note sampling frequency must be > carrier frequency!
subplot(2,1,2);
plot(t,y);
让我知道这对你有用。