Wrong output for phase demodulation I tried to plot phase demodulated signal and original message signal but there is a significant difference between magnitudes of the message and demodulated signal. I have attached the code and the graph. Please help in pointing out the error.

Code

clear all; close all;
fm = 50;
fc = 1000;
fs = 4000;

t = 0:1/fs:0.1;
kp1 = pi/2;

m_t = 5*cos(2*pi*fm*t);

x_pm = cos(2*pi*fc*t + kp1*m_t);

x = pmdemod(x_pm,fc,fs,kp1);

figure(1);
plot(t,x_pm);
title('phase modulated signal');

figure(2);
plot(t,x,t,m_t);
title('message and demodulated signal');
legend('demodulated signal','message signal');



plot
You tell the phase demodulator that the signal has a maximum phase deviation of $\pi/2$, but then you actually use a signal with a phase deviation of $5\pi/2$ (due to the amplitude of the message signal). This doesn't make sense.

Note that even the most ideal phase demodulator cannot distinguish between $\cos(2\pi f_ct+\phi(t))$ and $\cos(2\pi f_ct + \phi(t)+2k\pi)$, $k\in\mathbb{Z}$.