Clear Filters
Clear Filters

I have matlab codes bust i did not able to explain i Viva please examples all 4 code to me any one. CODE for Transmitter And Receiver.

1 view (last 30 days)
code 1
clc;
close all;
clear all;
h=0.5; fs=1000;
T=1/fs; t=0:T:1;
%Message Signal:
Am = 10;
fm = 10;
x = Am*sin(2*pi*fm*t);
figure;
figure(1);
plot(t, x);
lfftm=length(x);
ffm=fftshift(fft(x));
mfft=(-lfftm/2:lfftm/2-1)/(lfftm*T);
title('Message Signal');
xlabel('time(t)');
ylabel('Amplitude');
%X=fft(x);
figure(2);
plot(mfft,abs(ffm));
title('frequency domain msg');
code 2
%Carrier Signal:
Ac = Am/h; fc = 10*fm;
y = Ac*cos(2*pi*fc*t);
figure(3);
plot(t(1:1000), y(1:1000));
title('Carrier Signal');
xlabel('time(t)');
ylabel('Amplitude');
lfftmy=length(y);
ffmy=fftshift(fft(y));
mffty=(-lfftmy/2:lfftmy/2-1)/(lfftmy*T);
%Y=fft(y); figure(4);
plot(mffty,abs(ffmy));
title('frequency domain carrier');
code 3
%Modulated Signal:
z = ammod(x, fc, fs, 0, Ac);
figure(5);
plot(t(1:1000), z(1:1000));
title('Modulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
%Z=(fft(z));
lfftmz=length(z);
ffmz=fftshift(fft(z));
mfftz=(-lfftmz/2:lfftmz/2-1)/(lfftmz*T);
figure(6);
plot(mfftz,abs(ffmz));
title('frequency domain AM');
code4
%Demodulated Signal:
d = amdemod(z, fc, fs, 0, Ac);
figure(7);
plot(t(1:1000), d(1:1000));
title('Demodulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
ylim([-10, 10]);
%D=fft(d);
lfftmd=length(x);
ffmd=fftshift(fft(x));
mfftd=(-lfftmd/2:lfftmd/2-1)/(lfftmd*T);
figure(8);
plot(mfftd,abs(ffmd));
title('frequency domain demodulation');

Answers (0)

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!