Adcs Lab Report
Adcs Lab Report
Applica on of MATLAB There is a wide range of areas where MATLAB tools are applied. These areas
include mathema cs, physics, chemistry and chemical engineering, mechanical engineering,
biological (molecular biology) and medical sciences, communica on and control systems, digital
signal, image and video processing,
system modeling and simula on. Many interes ng problems have been included throughout the
book, and its contents will be beneficial for students and professionals in wide areas of interest.
S.NO. COMMAND SYNTAX/CODE
1 clc clc
clc clears all input and output from the Command Window
display, giving you a "clean screen."
help functionName
7 system system('Command')
Executes a system Command from within MATLAB
8 isvarname isvarname('variableName')
Checks if a string is a valid MATLAB variable name
9 isunix isunix
Checks if MATLAB is running on a UNIX-like platform
10 quit Quit
Terminates the MATLAB session
14 disp disp(X)
16 stem stem(Y)
stem(X,Y)
stem(Y) plots the data sequence Y as stems that extend from equally
spaced and automa cally generated values along the x-axis. When Y is a
matrix, stem plots all elements in a row against the same x value.
stem(X,Y) plots X versus the columns of Y. X and Y must be vectors or
matrices of the same size. Addi onally, X can be a row or a column
vector and Y a matrix with length(X) rows.
Gives a discrete plot
17 subplot subplot(m,n,p) or subplot(mnp)
Each axes graphics object can have one label for the x-, y-, and z-axis.
The label appears beneath its respec ve axis in a two-dimensional plot
and to the side or beneath the axis in a three-dimensional plot.
24 exp Y = exp(X)
The exp func on is an elementary func on that operates
element-wise on arrays. Its domain includes complex numbers.
Y = exp(X) returns the exponen al for each element of X.
25 abs abs(X)
Theory:
Defini on-
The Dirac delta func on, or δ func on, is (informally) a generalized func on on the real number line
that is zero everywhere except at zero, with an integral of one over the en re real line. The delta
func on is some mes thought of as an infinitely high, infinitely thin spike at the origin, with total
area one under the spike
∞, 𝑥 = 0
(n) =
0, 𝑥 ≠ 0
B: Unit Step
sequence [μ(n)]
Defina on-
The unit step func on is just a piecewise func on with a jump discon nuity at t = a.
Recall from calculus that a jump discon nuity is an x-value for which the limit doesn’t
exist. Then general form ofthe unit step func on is given below.
Mu(t-a) = 0, t<a
=M, t>a
D:Sine
Wave
Defini o
n- y=
sinx
E:Cosine
Wave
Defini on - y= cos x
Source code:
clc;
clear all;
close all;
m=input('enter the value of m');
n=-10:10;
for i=1:length(n)
if n(i)==0
y(i)=1;
else
y(i)=0;
end
end
subplot(2,3,1)
stem(n,y)
xlabel('n')
ylabel('y')
title('unit sample sequence');
for i=1:length(n)
if n(i)<0||n(i)>m
y(i)=0;
else
y(i)=1;
end
end
subplot(2,3,2)
stem(n,y)
xlabel('n')
ylabel('y')
title('unit stem sequence u(n)-u(n-M)');
for i=1:length(n)
if n(i)<0
y(i)=0;
else
y(i)=n(i);
end
end
subplot(2,3,3)
stem(n,y)
xlabel('n')
ylabel('y')
title('Ramp sequence');
t=-pi/2:0.1:pi/2;
y=sin(2*pi*t);
subplot(2,3,4)
stem(t,y)
xlabel('t');
ylabel('y');
title('sine')
t=-pi/2:0.1:pi/2;
y=cos(2*pi*t);
subplot(2,3,5)
stem(t,y)
xlabel('t');
ylabel('y');
title('cosine')
EXPERIMENT NO: - 2
OBJECT 2: WRITE A MATLAB PROGRAM TO GENERATE AN EXPONENTIAL
SEQUENCE.
X(n) = (a)n for (i) 0≤a≤1 (ii) -1≤a≤0 (iii)a≤-1 (iv)a>1
THEORY:
EXPONENTIAL SIGNAL IS GIVEN BY
X(n) = (a)n
DEPENDING UPON THE VALUE OF ‘a’ THE EXPONENTIAL CURVE
CAN BE
SOURCE CODE:
clc;
close all;
clear all;
a1=input('enter the value of a such that
0<=a<=1'); a2=input('enter the value of a such
that -1<=a<=0'); a3=input('enter the value of a
such that a<=-1'); a4=input('enter the value of a
such that a>1');
for n=1:20
x1(n)=(a1)^n;
x2(n)=(a2)^n;
x3(n)=(a3)^n;
x4(n)=(a4)^n;
end
subplot(2,2,1)
stem(x1);
xlabel('-----n--->');
ylabel(' x1(n)-->');
title('plot of x1');
subplot(2,2,2)
stem(x2);
xlabel('-----n >');
ylabel('-----x2(n)-->');
title('plot of x2');
subplot(2,2,3)
stem(x3);
xlabel('-----n >');
ylabel('-----x3(n)-->');
title('plot of x3');
subplot(2,2,4)
stem(x4);
xlabel('-----n >');
ylabel('-----x4(n)-->');
title('plot of x4');
plot of x1 plot of x2
1 1
0.8
0.5
-----x2(n)-->
x1(n)-->
0.6
0
0.4
-0.5
0.2
0 -1
0 5 10 15 20 0 5 10 15 20
-----n---> -----n>
6 plot of x3 5 plot of x4
10 10
1.5 12
1 10
8
-----x3(n)-->
-----x4(n)-->
0.5
6
0
4
-0.5 2
-1 0
0 5 10 15 20 0 5 10 15 20
-----n> -----n>
EXPERIMENT NO.: -3
OBJECT: WRITE A MATLAB PROGRAM TO GENERATE THE SIGNAL
S(n) = 2*n*(0.8^n) CORRUPTED BY THE NOISE d(n)
RESULTING THE SIGNAL X(n).
X(n) = s(n) + d(n)
ALSO DOWN SAMPLE THE CORRUPTED SIGNAL
0.8
3
----- s(n)>
0.6
----- d>
2
0.4
1
0.2
0 0
0 2 4 6 8 10 0 2 4 6 8 10
------ n> ------ n>
4 4
----- x1>
----- x2>
3 3
2 2
1 1
0 0
0 2 4 6 8 10 1 2 3 4 5
------ n> ------ n>
EXPERIMENT NO.: - 4
OBJECT: GENERATE A GAUSSIAN NUMBER WITH MEAN = 20 AND
VARIANCE = 40. ALSO PLOT THE PDF OF GENERATED NUMBER
0.06
0.05
0.04
----y(x)>
0.03
0.02
0.01
0
0 5 10 15 20 25 30 35 40
----x>
EXPERIMENT NO.: - 5
AIM: TO STUDY AMPLITUDE MODULATION AND
DEMODULATION USING BOTH MATALB
CODE AND SIMULINK
m(t)=Amcos(2πfmt)
c(t)=Accos(2πfct)
Where,
s(t)=[Ac+Amcos(2πfmt)]cos(2πfct) (Equation 1)
AMPLITUDE DEMODULATION
The process of extracting an original message signal from the
modulated wave is known as detection or demodulation. The
circuit, which demodulates the modulated wave is known as
the demodulator. The following demodulators (detectors) are used
for demodulating AM wave.
m=
0.5000
SIMULINK
EXPERIMENT NO.: - 6
OBJECT: - TO STUDY FREQUENCE MODULATION AND
DEMODULATION
THEORY: - Frequency Modulation is a modulation in which the frequency of the carrier
wave is altered in accordance with the instantaneous amplitude of the modulating signal,
keeping phase and amplitude constant. Modification of carrier wave frequency is performed
for the purpose of sending data or information over small distances.
FREQUENCY DEMODULATION
Demodulation is the act of extracting the original information- bearing signal from a
modulated carrier wave or the process of separating the original information or signal
from the modulated carrier wave. This process is used in the receivers to recover the
original signal coming from the sender end n modulating form. We can say that its
function is opposite to that of modulation process. There are several ways to
demodulation depending upon how parameters of the base-band signal are
transmitted in the carrier signal, such as amplitude, frequency or phase. For a signal
modulated with a linear modulation, like Amplitude modulation we can use a
synchronous detector, for a signal modulated with an angular modulation use a
Frequency demodulator.
REQUIREMENT: -
MATALB
PROGRAM: -
SOURCE CODE
clc
clear all
Fs = 8000;
Fc = 100;
t = linspace(0,1,10000);
x = sin(2*pi*10*t)
dev = 50;
y = fmmod(x,Fc,Fs,dev);
z = fmdemod(y,Fc,Fs,dev);
subplot(411),plot(t,x)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('MODULATING SIGNAL');
subplot(412),plot(t,sin(2*pi*Fc*t))
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('CARRIER SIGNAL');
subplot(413),plot(t,y)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('FREQUENCY MODULATED SIGNAL');
subplot(414),plot(t,z)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('DEMODULATED SIGNAL')