coding FM modulation

1 回表示 (過去 30 日間)
Michael Adelman
Michael Adelman 2012 年 6 月 16 日
|hi,
I'm writing FM modulation according the plain math (without any matlab functions): http://www.st-andrews.ac.uk/~jcgl/Scots_Guide/RadCom/part12/page1.html
Fs = 100e3; % Sampling frequency for audio
dt = 1/Fs; %to reduce number of elements in the vector and increase
% calaulation time.
T = 1;
%t = 0:dt:T/2;
t = (0:Fs-1)/Fs;
df = 1/T;
Fmax = 1/2/dt;
f = -Fmax:df:Fmax-1;
% Carrier
fc = 10e3;
% Information - Time domain
fm = 200; %in Hz
Am = 1;
Kp = 7.5;
ym = Am*sin(2*pi*fm.*t);
deltaF = Kp*Am;
% Modulation
beta = deltaF/(fm);
y = 4*cos(2*pi*fc.*t+beta*sin(2*pi*fm.*t));
% Frequency domain
Y = fftshift(fft(y))/length(y);
% Plots - Time domain
figure(1);
subplot(211), plot(t,cos(2*pi*fm.*t)),axis([0.21 0.221 -1.5 1.5]), grid on;
subplot(212), plot(t,y), axis([0.21 0.221 -5 5]), grid on;
% Plots - frequency domain
figure(2);
plot(f,10*log10(abs(Y))), grid on;
%end code
Only at very high values of Kp I'm getting correct results in time domain but in frequency i'm still not getting correct results.
Please help.
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 6 月 16 日
You are using *many* MATLAB functions. See http://www.mathworks.com/matlabcentral/answers/38787-what-can-be-programmed-without-any-built-in-functions

サインインしてコメントする。

採用された回答

Michael Adelman
Michael Adelman 2012 年 6 月 16 日
Hello Walter,
Thank you for the comment. I actually asked more on the FM modulation coding and incorrect outputs that get. Can you comment on that matter?
Thanks,
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 6 月 17 日
It is not possible to get an output without using a MATLAB function, so getting any output at all is incorrect when you are under the restriction of not using any MATLAB functions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by