Professional Documents
Culture Documents
Table of Contents
OBJECTIVE .........................................................................................................................................................................................1
THEORY .............................................................................................................................................................................................1
PROGRAMMERS ................................................................................................................................................................................3
DISCUSSION .......................................................................................................................................................................................5
Objective
Familiarization with MATLAB interface, workspace, command window
Basic operation in MATLAB
Creating and storing new files ,folders and scripts in MATLAB
Theory
MATLAB (matrix laboratory) is a programming language developed by MathWorks. It started out as a matrix programming
language where linear algebra programming was simple. It can be run both under interactive sessions and as a batch
job..
Features of MATLAB
Following are the basic features of MATLAB −
It is a high-level language for numerical computation, visualization and application development.
It also provides an interactive environment for iterative exploration, design and problem solving.
It provides vast library of mathematical functions for linear algebra, statistics, Fourier analysis, filtering,
optimization, numerical integration and solving ordinary differential equations.
It provides built-in graphics for visualizing data and tools for creating custom plots.
MATLAB's programming interface gives development tools for improving code quality maintainability and
maximizing performance.
It provides tools for building applications with custom graphical interfaces.
It provides functions for integrating MATLAB based algorithms with external applications and languages such as
C, Java, .NET and Microsoft Excel.
The desktop has the following panels –
Current Folder − This panel allows you to access the project folders and files.
Command Window − This is the main area where commands can be entered at the command line. It
is indicated by the command prompt (>>).
Command Window − This is the main area where commands can be entered at the command line. It
is indicated by the command prompt (>>).
Command History − This panel shows or return commands that are entered at the command line.
Naming Variables
Variable names consist of a letter followed by any number of letters, digits or underscore.
MATLAB is case-sensitive.
Variable names can be of any length, however, MATLAB uses only first N characters, where N is given by the
function namelengthmax.
Creating Matrices
A matrix is a two-dimensional array of numbers.
In MATLAB, a matrix is created by entering each row as a sequence of space or comma separated elements,
and end of a row is demarcated by a semicolon.
Multidimensional Arrays
An array having more than two dimensions is called a multidimensional array in MATLAB. Multidimensional
arrays in MATLAB are an extension of the normal two-dimensional matrix.
Generally to generate a multidimensional array, we first create a two-dimensional array and extend it.
Comment
% symbol is used to write comment in MATLAB
Programmers
%Script for Adding matrix A of size 2X2 and matrix B of size 2X2 are given below
clc
clear
a=[4,4,4;8,8,8];
b=[1,1,1;2,2,2];
mat=a+b
Output
%Script for subtracting matrix A of size 3X3 from matrix B of size 3X3 are given below
clc
clear
b=[4,4,4;6,6,6;10,10,10];
a=[1,1,1;2,2,2;3,3,3];
matsub=b-a
Output
Multiplying matrix A of size 3X3 and matrix B of size 3X3
%Script for multiplying matrix A of size 3X3 and matrix B of size 3X3 are given below
clc
clear
A=[1,0,0;0,1,0;0,0,1];
B=[3,3,3;5,5,5;7,7,7];
matmul=A*B
output
Output
Discussion
In the first lab of signal analysis we got to know about the importance of MATLAB in engineering and how it is used by
various engineers for making complex task easier where we can also perform simulation and can predict the possible
outcome of our work. There we came to know about various windows layout setting, creating script files & saving script
files on local computer disk so that we can run our entire program anytime. We also learn how to comment in MATLAB
using % symbol. There was problem while running a script file and it was solved with our teacher instruction and finally
we performed addition subtraction as well as multiplication and division of numbers and matrices of various order.