Question
The filtering part must be changed in this code, Please help! The filtering process in this code should not be done with the filter command.
The filtering part must be changed in this code, Please help!
The filtering process in this code should not be done with the filter command. (This is the part that needs to be changed.) You can define the transfer function of the filters and filter by multiplying the input signal with the Fourier transform. The filtering process should be done in the frequency domain using the FFT and IFFT commands. PLEASE HELP ASAP, THANKS.
Task:
() = 10(50) + 20(100) message sign () = 100(500) carrier
It modulates the signal.
1-Plot the message sign in a period. The spectrum of the message sign plot it
2-Plot the modulated sign (). The spectrum of the modulated signal plot it
3-The demodulator uses the (100) carrier. At the LPF input in the demodulator Plot the sign e() and its spectrum.
4-Plot the signal z () and its spectrum at the LPF output on the demodulator.
Code:
%DSB_SC
Ts=0.0001; T=0.04; %time period t=0:Ts:T; m_t=10*cos(50*pi*t)+20*cos(100*pi*t); %message signal c_t=100*cos(500*pi*t); %carrier signal y_t=m_t.*c_t; %DSB-SC signal
%part a, message signal and spectrum lfft=length(m_t); lfft=2^ceil(log2(lfft)); m_f=fftshift(fft(m_t,lfft));%spectrum of message signal f=(-lfft/2:1:lfft/2-1)/(lfft*Ts); subplot(4,1,1); plot(t,m_t); xlabel("Time t in seconds"); ylabel(" m(t)"); figure(1);
subplot(4,1,2); plot(f,abs(m_f)); xlabel("Frequency in Hertz"); ylabel(" M(f)");
%part b, modulated signal and spectrum lfft=length(y_t); lfft=2^ceil(log2(lfft)); y_f=fftshift(fft(y_t,lfft));%spectrum of DSB_SC signal f=(-lfft/2:1:lfft/2-1)/(lfft*Ts); subplot(4,1,3); plot(t,y_t); xlabel("Time t in seconds"); ylabel(" y(t)");
subplot(4,1,4); plot(f,abs(y_f)); xlabel("Frequency in Hertz"); ylabel(" Y(f)");
%part c demodulation: c2_t=cos(100*pi*t); e_t=y_t.*c2_t;
lfft=length(e_t); lfft=2^ceil(log2(lfft)); %Spectrum of received signal after carrier multiplication e_f=fftshift(fft(e_t,lfft)); f=(-lfft/2:1:lfft/2-1)/(lfft*Ts); figure(2);
subplot(4,1,1); plot(t,e_t); xlabel("Time t in seconds"); ylabel(" e(t)");
subplot(4,1,2); plot(f,abs(e_f)); xlabel("Frequency in Hertz"); ylabel("e(f)");
%part d, LPF ouput signal and spectrum
h=fir1(40,[50*Ts]); z_t=filter(h,1,e_t);%ideal low pass filter lfft=length(z_t); lfft=2^ceil(log2(lfft)); z_f=fftshift(fft(z_t,lfft)); f=(-lfft/2:1:lfft/2-1)/(lfft*Ts); subplot(4,1,3); plot(t,z_t); xlabel("Time t in seconds"); ylabel(" z(t)");
subplot(4,1,4); plot(f,abs(z_f)); xlabel("Frequency in Hertz"); ylabel("z(f)");
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started