In: Computer Science
Write a Matlab function called “SimpleChannel” which takes
a signal as an input, simulates a channel and returns the
transmitted signal.. SimpleChannel function will add a randomly
generated noise (look for “rand” function) to the signal and return
it. You can adjust the amplitude of the noise as you want in order
to have a distinct noise effect. Then write another matlab code to
show the channel noise. First create the signal and then simulate
the channel by using your SimpleChannel function. Lastly plot the
two signals in the same figure to show the effect of the
noise.
Function : [Tran] = SimpleChannel(Rec)
The Signal : x(t) = 2 cos(2πt) + 3 cos(4πt)
Time interval : from 0s to 5s incremented by 0.01s
Note: Don’t forget to put title and label names.
clear
clc
close all
t=0:.01:5;
x=2*cos(2*pi*t) + 3*cos(4*pi*t);
noisy=SimpleChannel(x);
plot(t,x,'k','linewidth',2.5)
hold on
plot(t,noisy,'r')
xlabel('time')
ylabel('signal')
legend('original','noisy')
title('Simple Channel')
function [Tran] = SimpleChannel(Rec)
%you can change thse parameters as you wish
maxValue=1;
minValue = -1;
noise = minValue+(maxValue-minValue)*rand(size(Rec));
Tran = Rec+noise;
end