Introduction To MATLAB
Introduction To MATLAB
Introduction To MATLAB
: 01
1.2 Experiment Name
Introduction to MATLAB
1.3 Objectives:
i) To gain basic knowledge about the MATLAB.
ii) To know about different window of MATLAB.
iii) To know how to plot in MATALAB
1.4 Theory
MATLAB stands for Matrix Laboratory. It is a high-performance language that is used for
technical computing. It was developed by Cleve Molar of the company MathWorks.Inc in the
year 1984.It is written in C, C++, Java. It allows matrix manipulations, plotting of functions,
implementation of algorithms and creation of user interfaces.
Function Description
atan2(x,
To compute the arctangent or inverse of y/x
y)
1.4.3 Writing a MATLAB Program
Using Command Window: Only one statement can be typed and executed at a time. It
executes the statement when the enter key is pressed. This is mostly used for simple
calculations. Note: ans is a default variable created by MATLAB that stores the output of the
given computation.
Using Editor: Multiple lines of code can be written here and only after pressing the run button
(or F5) will the code be executed. It is always a good practice to write clc, clear and close all
in the beginning of the program.Note: Statements ending with a semicolon will not be
displayed in the command window, however, their values will be displayed in the workspace.
Any statement followed by % in MATLAB is considered as a comment
Vector Operations: Operations such as addition, subtraction, multiplication and division can
be done using a single command instead of multiple loops.
1.4.4 Plotting in MATLAB
The MATLAB graphics system consists of high-level commands for two-dimensional and
three-dimensional data visualization, image processing, animation, and presentation graphics.
It also includes low-level commands that allows to fully customize the appearance of graphics
as well as to build complete Graphical User Interfaces.
To plot a function y=x.^2-4*x-10 required MATLAB code is
clc
clear all
x=-10:1:10;
y=x.^2-4*x-10;
plot(x,y)
grid on