Skip to main content

MATLAB tutorial for Begineers Part 1

MATLAB is abbreviation for MATrix LABoratory.

MATLAB is an integrated development environment and computer language that enables users to perform computationally intensive tasks.  The software is used for numerical computation tasks, visualization, and mathematical programming.
For more details, see http://www.mathworks.com/products/matlab.

Latest release of MATLAB is R2014a.

As the name emphasis, MATLAB considers every variable/value in terms of matrices.
MatLab vs c: MatLab is not a programming language, but it is a scripting language. In simple English, you use English-like commands in the MatLab program; whereas corresponding c program will run in the background.

So, MatLab program is slower than c program; but is more flexible and lightweight than the former. 


The latest MATLAB constitutes FOUR platforms, within its environment.
1. M-file/Script file platform
2. Simulink
3. GUIDE- Graphical User Interface IDE(Integrated Development  Envinirment)
4. Matlab APPLICATIONS


Note: All these four are not independent, but dependent on each other. It is recommended to start with M-file/script-file programming for a beginner.


Cost of MatLab: MatLab is a proprietary software, but it is worthy-enough to pay for it. Even there is free student version of MatLab, which is available on demand from the mathworks website.
A humble request is to buy the MatLab products, and don't be a part of pirating the software(which is done by many torrent-hosting/file-sharing  websites).
Platform support: MatLab is available in Windows, Unix  and Macintosh platforms. The Unix flavor is used for linux too.
Alternatives to MatLab: In contract, there are free alternatives for MatLab, such as Octave, Scilab,etc. Scilab is available in windows and linux platforms; whereas Octave is available only for Linux platform.

Matlab programs are backward compatible.

MATLAB is a proprietary software, patented by MathWorks Inc.
Though it is commercial, the free student version can be downloaded from MathWorks website, on registration.

Windows in MATLAB:

By default, you will see the default window layout.
Else, to get the default layout of windows in MATLAB, go to File->Desktop->Desktop Layout->Default.

1. Command Window: It is heart of MATLAB, where the response of all inputted commands will the displayed, expect the graphical responses.

2. Command History: It stores all the commands executed in the command window, including the date and time of their execution.
It doesn't store commands executed through script-files.


3. Current Folder (Current working Directory): Indicates the current folder to which matlab is associated. All user-defined functions and other files(images, audio files, video files..) must be in the current folder. Also, the current folder association can also be changed.

4. Workspace: It stores all the variables, their data, data types, and some more information about the variables used in current computations. The variables can be cleared. Closing Matlab, automatically results in clearing of workspace.

5. Editor Window: All the M-files/script files must be written in this editor. Optionally, notepad can also be used as matlab editor, where the file should be saved with .m extension to make an M-file. But, Editor Window has some advanced options like direct execution, publishing, ...

6. Figure Window: All the graphical responses will be displayed in this window. By default, it saves with .fig extension; but there are options to save as conventional file formats like .jpg. .png,...

 File Types in MATLAB:

1) .m files -> These are the Matlab script files. user-defined functions are also saved as .m files.
2) .fig files -> The default file type to save the images/figures. The GUIDE files are also saved with .fig extension.
3) .mdl files -> The Simulink Model files are saved with .mdl extension. mdl files are text files.
4) .slx files -> New file format to save the simulink models, release from R2012a. SLX is a compressed file that contains model information in XML format.
 Note: It is optional to the user to choose between .mdl and .slx extensions.

5).mat files-> It is similar to the .dat file, used to store data.


Apart from these proprietary file formats, Matlab supports few file formats to import and export data.



          

Comments

Popular posts from this blog

NSG 2.1 Tcl/OTcl Script Generator

Are you a beginner for ns2 network simulator? Are you afraid of Tcl/oTcl script generation? Then there is a tcl script generator, named NSG 2.1 NSG - Network Simulation Generator NSG 2.1 is a java .jar file.  So, this application can run on all platforms (windows/linux/mac os). It deserves the java installed in you pc, prior to working with NSG 2.1. Java must be installed to run NSG2.1. So, initially, java must be installed. How to install java in Windows/ubuntu/mint/debian linux/ OS X ? Step 1 : Go to Terminal and run  java -version   to check the java version installed in your machine. Step 2 :  For Windows, click here  to download the java installer. Then, it is a typical next-next windows executable installation. For ubuntu/mint/debian linux operating systems, run the following commands in that terminal: sudo apt-get install default-jre sudo apt-get install default-jdk sudo apt-get install openjdk-7-jre sudo apt-get install openjdk-7- jdk How to

SUMO installation in linux (Debian/Ubuntu/Mint)

SUMO - S imulation of U rban Mo bility SUMO an open source, portal, microscopic, multi-modal road traffic simulation. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.  It allows to simulate as to how a given traffic demand which consists of single vehicles moves through a given road network. The simulator allows to address a large set of traffic management topics. It is purely microscopic: each vehicle is modeled explicitly, has an own route, and moves individually through the network. SUMO Installation Procedure: Installation in Linux and mac OS Step I: Install two pre-requisite packages to build SUMO with GUI. Go to terminal and run: $ sudo apt-get install libgdal1-dev proj libxerces-c2-dev $ sudo apt-get install libfox-1.6-dev libgl1-mesa-dev libglu1-mesa-dev Step II: If you are using Unbuntu 12.04 or older versions, as it doesn't ship with libgdal package, create a symbolic link: $ sudo ln -s /usr/lib/li

getattrib, Setattrib, hasattrib and delattrib in python

# `getattr(object, name[, default])` Function in Python The `getattr(object, name[, default])` function returns the value of a named attribute of an object, where `name` must be a string. If the object has an attribute with the specified `name`, then the value of that attribute is returned. On the other hand, if the object does not have an attribute with `name`, then the value of `default` is returned, or `AttributeError` is raised if `default` is not provided. ```python >>> t = ('This', 'is', 'a', 'tuple') >>> t.index('is') 1 >>> getattr(t, 'index') <built-in method index of tuple object at 0x10c15e680> >>> getattr(t, 'index')('is') 1 ``` when the attribute is not defined, ```python >>> getattr(t, 'len') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'tuple' object has no attribute 'len