How to solve error performing FM Demodulation in octave?

571 Views Asked by At

I am trying to demodulate a modulated FM Signal. As you can see in the code below I use fmmod to modulate the FM signal, however when I use fmdemod or ademodce then neither returns anything similar to the original signal. For fmdemod I believe it is that you can not enter freqdev as in fmmod, so it does not perform the reverse. With ademodce I have no idea why that is not working. Is there any other Octave function I can use to attain the original signal again or how do I use either one of these two correctly to do it?

See example code below:

    [sound2,fs]=audioread('sound2.wav');
    
    fc=7500;
    freqdev=100;
    dt=1/fs;
    len=length(sound2)*dt;
    
    t=0:dt:len;
    t=t(1:end-1);
    t1=t(1:end-1);
    
    FMmod=fmmod(sound2.',fc,fs,freqdev);
    FMDemod=ademodce(FMmod,fs,"fm",freqdev); %Or fmdemod(FMmod.',fc,fs) Neither is working.
    
    sound(sound2,fs)
    sound(FMDemod,fs)
    
    
    subplot(2,2,1),plot(t,sound2),title('Original Sound');
    
    subplot(2,2,2),plot(t,FMmod,'r'),title('FM Modulated');
    
    subplot(2,2,3),plot(t,FMDemod,'g'),title('FM De-Modulated');
    
    subplot(2,2,4),plot(t,FMmod-sound2.'), title('Carrier Signal');
0

There are 0 best solutions below