Hi Sowmia MR
1.
One way to answer your question is, without losing constant amplitude, which is a good quality of FM:
f1_range=120*[1:1/3:4]
f1=f1_range(randi([1 9],1,9))
A=1;
y1=0
for k=1:1:numel(f1)
y1c=A*sin(2*pi/f1(k)*[1:1:f1(k)]);
y1=[y1 y1c];
end
plot(y1)
.
2.
Another way would be constraining the amount of samples for each frequency to a constant value, that would be of 1 cycle of f0=120Hz
f0=120
f1_range=f0*[.7:.1:1.3]
f1=f1_range(randi([1 numel(f1_range)],1,numel(f1_range)))
A=1;
y1=0
for k=1:1:numel(f1)
y1c=A*sin(2*pi*f1(k)/f0*[0:1/f0:1]);
y1=[y1 y1c];
end
plot(y1)
.
3.
Note that now it's not 10 cycles but 7, 7*120 are the 840 samples shown above 2nd graph.
Recommended reading 'Telecommunication Systems' by Bruce Carlson
4.
Please not that f1_range is on purpose chosen 'not too wide'.
If so alias occurs, data loss, the output signal and plot may be meaningless.
5.
If you want to learn more about FM basics with MATLAB, please check my accepted answer to question in this link:
there's an explanation how to FM modulate a signal, with MATLAB and with SIMULINK
So, Sowmia MR
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
Best Answer