I need to present frequency modulation of 2 armonic signals, using only traditional formulas (no fmmod), the modulated signal doesn't look right. Can someone help?
8 views (last 30 days)
Show older comments
This is my code, I have a modulating signal a carrier signal and I need to show FM using a BETA=0.1 (modulation index). These are the only formulas present in my UNI Course :
y=cos(2*pi*Fc*t+B*sin(2*pi*Fm*t)) //GENERAL FORMULA
y=Ac.*cos(Oc*t)-B*Ac.*sin(Wm*t).*sin(Oc*t) //B=0.1
y=Ac.*cos(Oc*t)-(B*Ac)/2.*cos((Oc-Wm)*t)+(B*Ac)/2.*cos((Oc+Wm)*t).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1264350/image.png)
//top is modulating signal,middle is carrier,bottom is modulated
Using these formulas I get the exact same result; I can see that the modulation is not happening, as the modulated signal 'y' has a constant frequency and looks similar to the carrier.
Is there a problem with the formulas, or is my code missing something?
(I am new to MATLAB coding and the teacher told us this problem was difficult, so I am assuming there are extra steps I need to take.)
//CODE STARTS HERE
clc
close all
format long
Fm=10;%modulating frequency
Fc=100;%carrier frequency
Am=3;
Ac=3;
Fs=10000;
B=0.1;%B<0.4
Oc=Fc*2*pi;
Wm=Fm*2*pi;
Ts = 1/Fs;
t = 0 : Ts : 0.2;
xm=Am*sin(2*pi*Fm*t);%modulating signal
xc=Ac*cos(2*pi*Fc*t);%carrier signal
%y=cos(2*pi*Fc*t+B*sin(2*pi*Fm*t)) ; //B<0.4
%y=Ac.*cos(Oc*t)-B*Ac.*sin(Wm*t).*sin(Oc*t);
y=Ac.*cos(Oc*t)-(B*Ac)/2.*cos((Oc-Wm)*t)+(B*Ac)/2.*cos((Oc+Wm)*t)
figure
subplot(3,1,1)
plot(t,xm,'r')
subplot(3,1,2)
plot(t,xc,'b');
subplot(3,1,3)
plot(t,y,'g');
grid
//CODE ENDS HERE
0 Comments
Answers (1)
Vishwa
on 24 Mar 2023
Hi Stefan,
Only your first equation is for frequency modulation rest two are for amplitude modulation, so use that only.
y=cos(2*pi*Fc*t+B*sin(2*pi*Fm*t)) //GENERAL FORMULA
Also it just so happens that your modulation index is very low (B=0.1), so your modulated waveform is visibily indistinguishable from your carrier.
Here is your code with value of modulation index equal to 5.
clc
close all
format long
Fm=10;%modulating frequency
Fc=100;%carrier frequency
Am=3;
Ac=3;
Fs=10000;
B=5;%B<0.4
Oc=Fc*2*pi;
Wm=Fm*2*pi;
Ts = 1/Fs;
t = 0 : Ts : 0.2;
xm=Am*sin(2*pi*Fm*t);%modulating signal
xc=Ac*cos(2*pi*Fc*t);%carrier signal
y=cos(2*pi*Fc*t+B*sin(2*pi*Fm*t)) ; %B<0.4
figure
subplot(3,1,1)
plot(t,xm,'r')
subplot(3,1,2)
plot(t,xc,'b');
subplot(3,1,3)
plot(t,y,'g');
grid
Hope it helps.
0 Comments
See Also
Categories
Find more on Modulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!