Header Ads

Header ADS

Analyze of noise affect in wireless transmitter Using MATLAB


Program Code:
clc;
clear all;
close all;
%%user define

fs=input('enter the value of sampling frequency');
fm=input('square wave modulation frequency');
fc=input('enter the value of carrier frequency');
n=2*(6*fs/fm);
final=(1/fs)*(n-1);
fc=2e5;%carrier frequency
t=0:1/fs:(final);
Fn=fs/2;%nyquist frequency
% Generate square wave by using cosine wave
%cosine wave
% 2 pi fc t is written as below
twopi_fc_t=2*pi*fm*t;
A=1;
phi=0;
x=A*cos(twopi_fc_t+phi);
%square wave
am=1;
x(x>0)=am;
x(x<0)=0%use for ASK-comment out BPSK
%x(x<0)=-1;%use for BPSK-remember ASK variables becomes BPSK
subplot(321);
plot(t,x);
axis([1e-4 3e-4 -2 2]);
title('square wave modulation input to trasmitter');
grid on
car=sin(2*pi*fc*t);%Sinwave carrier wave
ask=x.*car%modulation carrier(ASK or BPSK)
subplot(322)
plot(t,ask);
axis([0 100e-6 -2 2]);
title('Modulation Sinwave Carrier Waveform');
grid on;
%Noise generate SNR=Eb/No=20log(Signalrms/Noiseerms)
%
%vn=0;
vn=.1;%set noise level 0.1~=6db=SNR=Eb/NO
noise=vn*(randn(size(t)));% noise generator
subplot(323);
plot(t,noise);
grid on;
title('Noise Level');
axis([0 .6e-3 -1 1]);
askn=(ask+noise);%modulation carrier plus noise
subplot(324);
plot(t,askn);
axis([0 100e-6 -2 2]);
title('Modulation carrier Waveform plus Noise');
grid on;

Result:
enter the value of sampling frequency 8e5
square wave modulation frequency 20e3
enter the value of carrier frequency 2e5



Report:
clc;
clear all;
close all;
%%user define

fs=input('enter the value of sampling frequency');
fm=input('square wave modulation frequency');
fc=input('enter the value of carrier frequency');
n=2*(6*fs/fm);
final=(1/fs)*(n-1);
fc=2e5;%carrier frequency
t=0:1/fs:(final);
Fn=fs/2;%nyquist frequency
% Generate square wave by using cosine wave
%cosine wave
% 2 pi fc t is written as below
twopi_fc_t=2*pi*fm*t;
A=1;
phi=0;
x=A*cos(twopi_fc_t+phi);
%square wave
am=1;
x(phi>=45)=1.414;
x(phi>=-45)=1.712;
x(phi>=135)=1.712;
x(phi>=-135)=1.414;

%use for QPSK-comment out BPSK
%x(x<0)=-1;%use for BPSK-remember QPSK variables becomes BPSK
subplot(321);
plot(t,x);
axis([1e-4 3e-4 -2 2]);
title('square wave modulation input to trasmitter');
grid on
car=sin(2*pi*fc*t);%Sinwave carrier wave
qpsk=x.*car;%modulation carrier(ASK or BPSK)
subplot(322);
plot(t,ask);
axis([0 100e-6 -2 2]);
title('Modulation Sinwave Carrier Waveform');
grid on;
%Noise generate SNR=Eb/No=20log(Signalrms/Noiseerms)
%
%vn=0;
vn=.1;%set noise level 0.1~=6db=SNR=Eb/NO
noise=vn*(randn(size(t)));% noise generator
subplot(323);
plot(t,noise);
grid on;
title('Noise Level');
axis([0 .6e-3 -1 1]);
qpskn=(qpsk+noise);%modulation carrier plus noise
subplot(324);
plot(t,askn);
axis([0 100e-6 -2 2]);
title('Modulation carrier Waveform plus Noise');
grid on;

Result:

No comments

Powered by Blogger.