# FM and PM waves

I have to find the FM and PM waves corresponding to this sawtooth signal:

I have found out the PM wave as:

I am getting the FM wave as this :

I have plotted this using Python. Can anyone please tell me whether these plots are correct? I think I have got the correct PM wave but shouldn't the FM wave frequency change depending on the positive and negative peaks of the message signal (sawtooth wave)? The time period of the sawtooth signal is 0.001 s

The code for the FM part:

f = 1000;
T = 1/f;
t = np.linspace(0, 10*(T), 1000);
sawtooth_wave = np.zeros([len(t),]);

for i in range(0,len(t)):
sawtooth_wave[i,] = signal.sawtooth(2*(np.pi)*f*t[i,]);

fc = 1*10**6;
kp = np.pi/4;
kf = 2000;

fm_wave = np.zeros([len(t),]);

for i in range(0,len(t)):
fm_wave[i,] = math.cos(2*(np.pi)*fc*t[i,]+2*(np.pi)*kf*scipy.integrate.trapz(sawtooth_wave[0:i,],dx=0.2E-6));


I have a little confusion in integrating the message signal in the FM part of the code.

• second is definitely wrong. Where is there any modulation of the frequency? Anyway, there's no single "PM (FM) waveform corresponding to this sawtooth" – it all depends on the carrier frequency, reference phase, and your modulation's sensitivity. Oct 10, 2021 at 20:22
• @MarcusMüller Can you please look at the code for generating the FM wave and tell me whether it is correct or not. Every value has been shown there including the frequency sensitivity constant, kf. I think that integration of the message signal is not correct in the code. Can you suggest a way to integrate the sawtooth message signal from 0 to time,t ? (as given in the general equation for an FM signal) Oct 10, 2021 at 20:37
• I don't have to look at the code - the result is wrong! (and you seem to know as much) Sorry, asking for code written to your specification is explicitly off-topic here, but I can recommend just looking at the hundreds of FM modulator software implementations you can find online – from liquidDSP to GNU Radio, to a ton of amateur radio softwares, this is really ubiquitous :) Oct 10, 2021 at 20:38
• @Marcus Müller Can you suggest a way to integrate the sawtooth signal from 0 to time t so that I can generate the FM wave. I do not need any codes, just the commands that are normally used will help a lot Oct 10, 2021 at 20:40
• well, this is in discrete time, so an integral from a to b is just a sum of all values from a to b. Oct 10, 2021 at 20:53