繁体   English   中英

MATLAB-FM调制

[英]MATLAB - FM Modulation

我正在尝试使用Matlab频率调制正弦信号。 我为相同的代码编写了以下代码:

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 = fmmod(x,fc,fs,dev);
subplot(2,1,2);
plot(t,y);

它能够显示第一个绘图命令,但不显示第二个命令。 它将引发错误: `fmmod' undefined near line 10 column 5 上面的代码有什么问题?

以下函数将生成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);

让我知道这对您有用。

我想这是更简单的方法

  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM