MATLAB is a numerical computing environment and fourth-generation programming language. IT is intended primarily for numerical computing. It started out as a matrix programming language where linear algebra programming was simple. Moreover, It can be run both under interactive sessions and as a batch job. It also allows matrix manipulations, creation of user interfaces, plotting of functions and data, implementation of algorithms, interfacing with programs written in other languages including Java, C, C++, and Fortran; examine data; develop algorithms; and create models and applications. MATLAB is now also widely used as a computational tool in science and engineering encompassing the fields of chemistry, physics, math and all engineering streams. MATLAB was first adopted by researchers and practitioners in control engineering, It is now used in education, in particular the teaching of numerical analysis, linear algebra, etc. Moreover, it is popular amongst scientists involved in image processing.
The main MATLAB application is built around the MATLAB scripting language. Common usage of the MATLAB application involves using the Command Window as an interactive mathematical shell or executing text files containing MATLAB code.
In today’s generation learning and knowing about MATLAB is very important and useful. All the calculations are done in moment very easily using matlab, all programmes are done using matlab. Basically MATLAB is a high-level language that includes mathematical functions for solving engineering and scientific problems. We can produce immediate results by interactively executing commands one at a time. In MATLAB, we write programs to automate our workflow, we Develop robust, maintain functions, etc
MATLAB is widely used in education as well as research at universities in all areas of applied mathematics, and in the industry. The term MATLAB stands for Matrix Laboratory and the software is built up around vectors and matrices which makes the software useful specifically for linear algebra but MATLAB is also a great tool for solving algebraic and differential equations and for numerical integration. MATLAB consists of powerful graphic tools and can produce nice pictures in 2D and 3D. Also, it is one of the easiest programming languages for writing mathematical programs. It also consists of some tool boxes that are useful for signal and image processing, optimization, etc.
At the heart of a digital computer is the central processing unit (CPU) which performs the logical and arithmetical operations on streams of numbers which is controlled by a stream of numbers called ‘program’. The CPU has full access to the computer memory which can be thought of a large number of pigeonholes in which numbers can be stored and later retrieved.
All pieces of information that we want the computer to manipulate must be stored as numbers since the CPU can only manipulate numbers. The philosophy of numbers for anything and everything is the basis of the power of the computer. When the CPU generates a numerical answer after calculating, that number is not necessarily just the size of something. It can be anything from character or a memory address to even the next operation of the CPU.
Structured programming is a software development paradigm in which problems are solved in a top-down fashion. As a program gets larger, it is sub-divided into sub-programs to provide code that is easier to read, debug, and maintain; also this approach facilitates reuse of commonly used procedures.
A matrix is a two-dimensional array of numbers.
In MATLAB, a matrix is created by entering elements in each row as comma or space delimited numbers and using semicolons to mark the end of each row.
1. Defining Matrices
2. Matrix Functions
3. Matrix Operations
For example, let us create a 4-by-5 matrix a:
a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]
MATLAB will return the following result by executing the above statement:
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
Matrix and Array Operations
MATLAB permits to process all of the values in a matrix using a single arithmetic operator or function.
a + 10
11 12 13
14 15 16
17 18 20
A function is a group of statements that perform a task together. In MATLAB, functions are defined in separate files where the name of both file and the function should be same.
Functions operate on variables within local workspace which is their own workspace, separate from the workspace you access at the MATLAB command prompt which is called the base workspace.
Functions may accept more than one input arguments and may return more than one output arguments
Syntax of a function statement is:
function [out1,out2, …, outN] = myfun(in1,in2,in3, …, inN)
The following function named mymax should be written in a file ‘mymax.m’. Here in this example, it takes five numbers as argument and returns the maximum of the numbers.
Create a function file ‘mymax.m’ and then type the following code in it:
function max = mymax(n1, n2, n3, n4, n5)
%This function calculates the maximum of the
% five numbers given as input
max = n1;
if(n2 > max)
max = n2;
if(n3 > max)
max = n3;
if(n4 > max)
max = n4;
if(n5 > max)
max = n5;
The function’s first line starts with the keyword function which provides the name of the function and also order of arguments. In the given example, the mymax function includes five input arguments and one output argument.
Right after the function statement comes the comment lines that provide the help text.
These lines are printed when you type:
MATLAB will return the following result after the execution of the above statement:
This function calculates the maximum of the
Five numbers given as input
You can call the function as:
mymax (34, 78, 89, 23, 11)
MATLAB will return the following result after the execution the above statement:
We will assume her that we know how to create vectors and matrices and know how to index into them. There are two types of Loops ‘
1. For Loops
2. While Loops
The for loop allows us to repeat certain commands. If you want to repeat some action in a predetermined way, you can use the For loop. All of the loop structures in matlab are started with a keyword such as for, or while and they all end with the word end. Another deep thought, eh.
The For loop is written around some set of statements, and you must tell Matlab where to start and where to end. Basically, you give a vector in the ‘for’ statement, and Matlab will loop through for each value in the vector.
If you don’t like the for loop, you can also use a while loop . The while loop repeats a sequence of commands as long as some condition is met. This can make for a more efficient algorithm. In the previous example the number of time steps to make may be much larger than 20. In such a case the for loop can use up a lot of memory just creating the vector used for the index. A better way of implementing the algorithm is to repeat the same operations but only as long as the number of steps taken are below some threshold.
MATLAB provides 15 fundamental data types. Every data type stores data that is in the form of a matrix or array. The size of this matrix or array is a minimum of 0-by-0 and this can grow up to a matrix or array of any size.
Data Type Description
int8 8-bit signed integer
uint8 8-bit unsigned integer
int16 16-bit signed integer
uint16 16-bit unsigned integer
int32 32-bit signed integer
uint32 32-bit unsigned integer
int64 64-bit signed integer
uint64 64-bit unsigned integer
Single single precision numerical data
Double double precision numerical data
Logical logical values of 1 or 0, represent true and false respectively
Char character data (strings are stored as vector of characters)
cell array array of indexed cells, each capable of storing an array of a different dimension and data type
Structure C-like structures, each structure having named fields capable of storing an array of a different dimension and data type
function handle pointer to a function
user classes objects constructed from a user-defined class
java classes objects constructed from a Java class
MATLAB is very important and very easy to operate, basically make our work easier and reduces time. It is growing a lot in industries and colleges and gaining popularity
If you have to evaluate large amounts of data that are acquired automatically by means of computers and other technical appliances. Examples are psychophysical experiments (eye tracking, galvanic skin resistance measurements and the like), internet questionnaires, or log file analyses. In these applications, it is way too laborious to manually pre-process every single data set with spreadsheet software and export it to a statistics software package. Thus, automating this process by means of a Matlab program will be profitable.
Moreover, the application of programmed data evaluation routines is a more efficient way if the evaluation procedure has to be changed over and over again to ‘fine-tune’ it. Re-calculating the whole data set with the changed procedure is then done in a snap.
Matlab offers a plethora of graphics functions, dedicated statistics functions and other interesting features which are not available in other software packages, or only in limited and inflexible implementations.
MATLAB has found applications in almost every branch of engineering – from Chemical to Electrical to Mechanical to Aerospace. Matlab is a multidisciplinary tool it is even used in finance, economics etc. therefore knowing matlab is definitely valuable. MATLAB is a programming language and can solve the problems in much less time as compared to other languages – c, c++ or Java.
The Demand of MATLAB professional is very high.
As far as scope of MATLAB is concerned, it is vast. If one has knowledge about MATLAB programming, he or she can be eligible to do research in programming, mathematics or even in mechanical engineering wherein one need to solve differential equations. Thus, there is huge scope of learning MATLAB.
Matlab is everywhere whether it’s Information Technology or Mechanical/Aerospace Engineering. It is used highly in ‘
1. Algorithm development.
2. Modeling simulation and prototype.
3. Scientific and Engineering graphics.
4. Data Analysist and Exploration.
your text in here…