Beruflich Dokumente
Kultur Dokumente
Submitted by:
Name ID
MAINUL ISLAM MAHI 18-38468-2
Marks Distribution:
%question1
%18-38468-2
%AB-CDEFG-H
clc;
clear;
fs = 1000;
FREQ1 = 183;
FREQ2 = 384;
FREQ3 = 468;
AMP1 = 38;
AMP2 = 84;
AMP3=46;
%Define signal
t = 0:1/fs:1-1/fs;
deg1=deg2rad(30);
deg2=deg2rad(60);
x1 = AMP1*cos(2*pi*FREQ1*t); % First Signal
x2 = AMP2*cos(2*pi*FREQ2*t+deg1); % Second Signal
x3 = AMP3*cos(2*pi*FREQ3*t+deg2); % Third Signal
cx = x1+x2+x3;
%Plot to illustrate that it is a cosine wave
subplot(5,1,1);
plot(t, x1);
title('Input signal');
xlabel('Time (s)');
ylabel('amplitude');
subplot(5,1,2);
plot(t, x2);
title('Input signal');
xlabel('Time (s)');
ylabel('amplitude');
subplot(5,1,3);
plot(t, x3);
title('Input signal');
xlabel('Time (s)');
ylabel('amplitude');
subplot(5,1,4);
plot(t, cx);
title('Composite signal');
xlabel('Time (s)');
ylabel('amplitude');
%FourierTransform
fcx=fftshift(fcx)/(fs/2);
f = fs/2*linspace(-1,1,fs);
figure;
length(fcx);
fcx_mag=abs(fcx);
subplot(5,1,5);
plot(fcx_mag);
title('Time Domain');
axis([-1000 1500 0 100])
xlabel('Frequency (Hz)');
ylabel('magnitude');
RESULT:
%question3, 4
%18-38468-2
%AB-CDEFG-H
clear;
clc;
FREQ1 = 183;
FREQ2 = 384;
FREQ3 = 468;
AMP1 = 38;
AMP2 = 84;
AMP3=46;
fs1=10000;
t=0:1/fs1:0.001;
deg1=deg2rad(30);
deg2=deg2rad(60);
x1=AMP1*sin(2*pi*FREQ1*t);
x2=AMP2*sin(2*pi*FREQ2*t+deg1);
x3=AMP3*sin(2*pi*FREQ3*t+deg2);
cx=x1+x2+x3;
A = 1;
a=0.1;
powfund = A^2/2;
powharm = a^2/2;
varnoise = a^2;
noise = a*randn(size(cx));
noisySignal = cx + noise;
bandwidth_with=obw(noisySignal,fs1);
SNR = snr(noisySignal);
defSNR = 10*log10(powfund/varnoise);
THD = thd(noisySignal);
defTHD = 10*log10(powharm/a);
SINAD = sinad(cx);
SNR = snr(cx);
bandwidth_with = obw(noisySignal,fs1);
bandwidth_without = obw(cx,fs1);
C = bandwidth_without*log2(1+SNR); % Capacity of the
channel
L=2^(C/(2*bandwidth_without));
output =[bandwidth_with bandwidth_without;C L;SNR SINAD];
RESULT: