lowpass filter design matlab

628 views Asked by At

I want to create a script that will manually modulate and demodulate a signal. I am using DSB-SC modulation and I am just confused on how to build the lowpass filter for the demodulation of the signal. Here is what I have so far:

close all;
clear all;
clc;
t = 0:0.000001:0.001;
Vm = [1,2,5];
Vc = 1;
fm = 2000;
fc = 50000;

for i = 1:3
    close all;
    amp  = Vm(i);
    m = Vm(i)*sin(2*pi*fm*t);
    c = Vc*sin(2*pi*fc*t);

    %modulated signal
    phi_DSB = m.*c;

    figure(1)
    plot(t,phi_DSB)
    hold on 
    plot(t, m)
    
    legend('DSB modulated signal','Message signal')
    txt = sprintf('DSB modulated signal with message amplitude %d', amp);
    title(txt)
    xlabel('Time')
    ylabel('Signal amplitude')
    demod = lowpass(phi_DSB,50000);
    pause(5)
end

As you can see I used the lowpass filter constructor but it requires the value to be between 0 and 1. Is there another way to construct a lowpass filter? How would I make the frequency between 0 and 1?

1

There are 1 answers

0
Kenneth Boyd On

When you call lowpass, you can specify the normalized cutoff frequency, which is between 0 and 1 or you can specify the cutoff frequency in Hz and the sample rate in Hz, which is what you want to do. So, add a 3rd input argument to the call to lowpass, the third argument will be your sample rate in Hz.