IST Lab Manual
IST Lab Manual
1) Command.
2) To perform the application of MATLAB for equation.
3) To perform the application of MATLAB for +, -, *, /.
4) To obtain the Fourier transform of a Signal.
5) To plot the graph of a Sine wave signal & its Power Spectrum.
6) To plot the graph of a Cosine wave signal & its Power Spectrum.
7) To plot the graph of Phase shift of Cosine wave signal & its Power Spectrum.
8) To plot the graph of Square wave signal & its Power Spectrum.
COMMANDS
General purpose commands:
Operators and special characters:
+ Plus; addition operator
_ Minus; subtraction operator
* Scalar and matrix multiplication operator
.* Array multiplication operator
^ Scalar and matrix exponentiation operator
.^ Array exponentiation operator
\ Left – division operator
/ Right- division operator
./ Array Left – division operator
.\ Array Right- division operator
: Colon; generates regularly spaced elements and
represents an entire row or column
() Parentheses ; encloses function arguments and array
indicates ; overrides precedence
[] Brackets; encloses array elements
. Decimal point
… Ellipses ; line-continuation operator
, Comma ; separate statements and element in a row
; Semi-colon ; separates columns and suppress display
% Percent sign ; designates a comment and specifies
formatting
_ Quote sign and transpose operator
._ Non – conjugated transpose operator
= Assignment (replacement) operator
Commands for managing a Session
Clc Clears command window
Clear Remove variables from memory
Exist Checks for existence of file or variable
Global Declares variable to be global
Help Search for a help topic
Look for Search help entries for a keyboard
Quit Stops MATLAB
Who Lists current variables
whos Lists current variables (long display)
%s Format as a string
%d Format as an integer
%f Format as a floating point value
%e Format as a floating point value in scientific notation
%g Format in the most compact form %f or %e
\n Insert a new line in the output string
\t Insert a tab in the output string
Array commands
Special matrices
Structure Function
Plotting Commands
Programming
Logical Function
M-Files
Timing
Exp(x) Exponential; ex
Log(x) Natural logarithm ; ln(x)
Log10(x) Common (base 10)logarithm ; log (x)= log10 (x)
Sqrt(x) Square root ; X
Trigonometric Functions
Hyperbolic Functions
Complex Functions
Statistical Functions
Numeric Function
String Function
Numerical Methods
Interpolation Functions
ODE Solvers
Theory:- MATAB is broadly use in all field of applied mathematics and non-
mathematics In research work. MATAB stands for matrix laboratory and the
software is built around a vector and matrics. MATAB has powerful graphic tool
and is also a programming language used in desktop etc, and is one of the earliest
programming languages for writing mathematical programs.
Working :- Program
X = 1, 2 ,3,4
Y = 2*x+2
Plot (X,Y)
X label (‘frequency’)
Y label (‘wavelength’)
Grid on.
Result:- After giving input in the program in MATLAB Software it gives a specific
graph upon given information i.e. from above program it gives the graph of
frequency Vs wavelength.
EXPERIMENT NO. – 2
Aim:- To perform the application of MATLAB for mathematical operations like +,- ,
*, / etc.
We all know , MATLAB stads for matrix laboratory and the software is built up
around vectors and the matrices MATLAB has powerful graphic tool and is also a
programming language and is one of the earliest programming languages writing
mathematical programs.
Working:- Program
For Addition:-
X= 27
Y = 23
Z=X+ Y
=50
For Subtraction:-
X=23
Y= 13
Z= x-y
=10
For Multiplication:-
X=4
Y= 3
Z = X*Y
=12
For Division:-
X = 169
Y = 13
Z = X/Y
Z=13
Result:- After giving input in the program in MATLAB software it gives the specific
values of different operations like addition, Subtraction , Multiplication and
Division.
EXPERIMENT NO. – 3
Theory:- Fourier transformation status that any waveform in the time domain can
be represented by the wetted same of sine as cosine. The same waveform can be
represented in the frequency domain as a pair of amplitude and phase values of
each component frequency . We obtain any waveform by adding sine wave each
with a particular amplitude and phase.
Working :- Program
Xn = [2345]
N=4
n =[0:N-1]
k =[0:N - 1]
nk = n’*k;
WNnk =WN^nk;
Xk = xn*WNnk
Xn = 2345
n = 0123
k = 0123
WN = 0.0000 – 1.0000i
Aim of the experiment :- To plot graph of a sine wave signal and its power
spectrum.
= A sin (wt + φ)
Fs = 150
T = 0:1/Fs:1
F = 5;
Nfft = 1024;
X = x(1:nff t/2)
Figure(1);
Plot(t,x);
X label (‘time(s)’);
Y label (‘amplitude’);
Figure(2);
Plot (f,mn);
X label (‘frequency’);
Y label(‘power’);
Waveform:-
Power Spectrum:-
Result:- The graph of sine wave signal and its power spectrum has ploted.
EXPERIMENT NO. – 5
Aim of the experiment :- To plot graph of a cosine wave signal and its power
spectrum.
= A cos (wt + φ)
Fs = 150
T = 0:1/Fs:1
F = 5;
xfft = 1024;
X = x(1:nff t/2)
mx=abs(x);
Figure(1);
Plot(t,mx);
Y label (‘amplitude’);
Plot(F,mx);
Figure(2);
X label (‘frequency’);
Y label(‘power’);
Waveform:
Power Spectrum:-
Result:- The graph of cosine wave signal and its power spectrum has ploted.
EXPERIMENT NO. – 6
Aim of the experiment :- To plot graph of a phase shift of cosine wave and its
power spectrum.
Theory :- The phase shift is the horizontal shift between the units and sine.To
measure the horizontal shift between two wave functions by graphing them.A
shift to the right is positive phase shift and a shift to the left is negative phase
shift use the trigonometry identity cos (x)=sin(x+pi/2) to show that we can obtain
the cosine function by shifting the sine wave pi/2 to the left.The cosine function is
therefore the sine function with a phase shift of –pi/2.
Mathematically,
The graph of sine and cosine are the same when sine is shifted left by pi/2.Such a
shifting is horizontal shifting.
Sin(x+pi/2)=cos x
Working:
Fs = 150
T = 0:1/Fs:1
F = 5;
Pha=1/3*pi
X=cos (2*pi*t*f*pha);
xfft = 1024;
x=fft(x,xfft);
X = x(1:nff t/2);
mx=abs(x);
F = (0:nfft/2 - 1)* Fs/nfft;
Figure(1);
Plot(t,x);
X label (‘time(s)’);
Y label (‘amplitude’);
Plot(F,mx);
Figure(2);
Plot(f,mx);
Y label(‘power’);
Waveform:
Power Spectrum:-
Aim of the experiment :- To plot graph of square wave signal and its power
spectrum.
Working program:-
Fs = 150
T = 0:1/Fs:1
F = 5;
xfft = 1024;
X = x(1:nff t);
X=x(1:xfft/2);
Mx=(0:xfft/2-1)* Fs/xfft;
Figure(1);
Plot(t,x);
Figure(2);
Plot(t,mx);
x label(‘freuency(Hz)’);
y label(‘power’);
Waveform:
Power Spectrum:-
Aim of the experiment :- To plot graph of phase shift of square wave and its
power spectrum.
Theory :- A pulse wave or a pulse trainis a kind of non sinusoidal wave form that
is similar to square wave, but does not have the symmetrical shape associated
with a perfect square wave.
Pulse wave forms look similar to square wave except that all the action takes
place above the x-axis .At the beginning of a pulse the voltage changes suddenly
form a low level close to the x-axis to a high level usually close to power supply
voltage.
Working program:-
Fs = 150;
T=-0.5;
1/fs=0.5;
W=0.2;
X=rect pulse(t,w);
Xfft=512;
X=fft(x,xfft);
X=x(1,xfft);
Mx=abs(x);
F=(0:xfft/2-1)*fs/xfft;
Figure(1);
Plot(t,x);
X label (‘time(s)’);
Y label (‘Amplitude’);
Figure(2);
Plot(f,mx);
X label (‘Frequency(Hz)’);
Y label (‘power’);
Waveform:
Power Spectrum:-