Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

What is matlab and How it works? An Overview and Its Use Cases

History & Origin of matlab

MATLAB was invented by mathematician and computer programmer Cleve Moler. The idea for MATLAB was based on his 1960s PhD thesis. Moler became a math professor at the University of New Mexico and started developing MATLAB for his students as a hobby.

Mathematical Origins

The mathematical basis for the first version of MATLAB was a series of research papers by J. H. Wilkinson and 18 of his colleagues, published between 1965 and 1970 and later collected in Handbook for Automatic Computation, Volume II, Linear Algebra, edited by Wilkinson and C. Reinsch. These papers present algorithms, implemented in Algol 60, for solving matrix linear equation and eigenvalue problems.

EISPACK and LINPACK

In 1970, a group of researchers at Argonne National Laboratory proposed to the U.S. National Science Foundation (NSF) to “explore the methodology, costs, and resources required to produce, test, and disseminate high-quality mathematical software and to test, certify, disseminate, and support packages of mathematical software in certain problem areas.” The group developed EISPACK (Matrix Eigensystem Package) by translating the Algol procedures for eigenvalue problems in the handbook into Fortran and working extensively on testing and portability. The first version of EISPACK was released in 1971 and the second in 1976.

In 1975, four of us—Jack Dongarra, Pete Stewart, Jim Bunch, and myself—proposed to the NSF another research project that would investigate methods for the development of mathematical software. A byproduct would be the software itself, dubbed LINPACK, for Linear Equation Package. This project was also centered at Argonne.

LINPACK originated in Fortran; it did not involve translation from Algol. The package contained 44 subroutines in each of four numeric precisions.

In a sense, the LINPACK and EISPACK projects were failures. We had proposed research projects to the NSF to “explore the methodology, costs, and resources required to produce, test, and disseminate high-quality mathematical software.” We never wrote a report or paper addressing those objectives. We only produced software.

Historic MATLAB

In the 1970s and early 1980s, I was teaching Linear Algebra and Numerical Analysis at the University of New Mexico and wanted my students to have easy access to LINPACK and EISPACK without writing Fortran programs. By “easy access,” I meant not going through the remote batch processing and the repeated edit-compile-link-load-execute process that was ordinarily required on the campus central mainframe computer.

So, I studied Niklaus Wirth’s book Algorithms + Data Structures = Programs and learned how to parse programming languages. I wrote the first MATLAB—an acronym for Matrix Laboratory—in Fortran, with matrix as the only data type. The project was a kind of hobby, a new aspect of programming for me to learn and something for my students to use. There was never any formal outside support, and certainly no business plan.

This first MATLAB was just an interactive matrix calculator. This snapshot of the start-up screen shows all the reserved words and functions. There are only 71. To add another function, you had to get the source code from me, write a Fortran subroutine, add your function name to the parse table, and recompile MATLAB.

What is  Matlab?

MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include:

  • Math and computation
  • Algorithm development
  • Modeling, simulation, and prototyping
  • Data analysis, exploration, and visualization
  • Scientific and engineering graphics
  • Application development, including Graphical User Interface building

MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar noninteractive language such as C or Fortran.

The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects, which together represent the state-of-the-art in software for matrix computation.

MATLAB has evolved over a period of years with input from many users. In university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the tool of choice for high-productivity research, development, and analysis.

MATLAB features a family of application-specific solutions called toolboxes. Very important to most users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are comprehensive collections of MATLAB functions (M-files) that extend the MATLAB environment to solve particular classes of problems. Areas in which toolboxes are available include signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many others.

The MATLAB language.

This is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features. It allows both “programming in the small” to rapidly create quick and dirty throw-away programs, and “programming in the large” to create complete large and complex application programs.

The MATLAB working environment.

This is the set of tools and facilities that you work with as the MATLAB user or programmer. It includes facilities for managing the variables in your workspace and importing and exporting data. It also includes tools for developing, managing, debugging, and profiling M-files, MATLAB’s applications.

Handle Graphics.

This is the MATLAB graphics system. It includes high-level commands for two-dimensional and three-dimensional data visualization, image processing, animation, and presentation graphics. It also includes low-level commands that allow you to fully customize the appearance of graphics as well as to build complete Graphical User Interfaces on your MATLAB applications.

The MATLAB mathematical function library.

This is a vast collection of computational algorithms ranging from elementary functions like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transforms.

The MATLAB Application Program Interface (API).

This is a library that allows you to write C and Fortran programs that interact with MATLAB. It include facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing MAT-files.

How matlab works aka matlab architecture?

Simulink facilitates component-based modeling and modular design. You can segment your model into design components and then model, simulate, and verify each component independently. You can save individual components as blocks in a library or as separate files.

Organizing your model into hierarchical components can improve readability, traceability, and reusability, while allowing for concurrent development and unit testing. To mimic real-life systems, define components based on self-contained system functionality.

MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include: Math and computation. Algorithm development.

Uses of MATLAB

MATLAB is widely used as a computational tool in science and engineering encompassing the fields of physics, chemistry, math and all engineering streams. It is used in a range of applications including −

  • Signal Processing and Communications
  • Image and Video Processing
  • Control Systems
  • Test and Measurement
  • Computational Finance
  • Computational Biology

Feature and Advantage of using Matlab?

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.

Matlab Advantages

  • Implement and test your algorithms easily
  • Develop the computational codes easily
  • Debug easily
  • Use a large database of built in algorithms
  • Process still images and create simulation videos easily
  • Symbolic computation can be easily done
  • Call external libraries
  • Perform extensive data analysis and visualization
  • Develop application with graphics user interface

Best Alternative of Matlab.

List of Matlab Alternatives
  1. GNU Octave. If you are looking for anything closer to Matlab in terms of compatibility and computational ability, then Octave is the best Matlab alternative.
  2. Scilab. Scilab is an open-source similar to the implementation of Matlab.
  3. Maxima.
  4. Sage Math.
  5. AnyLogic.
  6. Enterprise Architect.
  7. Julia.

Free Video Tutorials of matlab

Interview Questions and Answer for  Matlab

2. How to plot a graph in MATLAB?

For any two points x and y with some values given, a function called plot (x, y) is used to plot a graph in MATLAB.

_________________________________

Syntax :  x : [value of array];

                 y : [value of array];

                 plot(x, y)
__________________________

3. How to call a function in MATLAB?

Ans. A function in MATLAB can be called using the name you give to the function, but first it needs to be written in the New Script tab under the File Tab. You can simply call the function by writing the function’s name in the code area.

__________________________

>> function_name (in the work area)
____________________

4. How to run MATLAB code?

NOTE:- Before running any code, make sure you save the respective code, so that your progress doesn’t fly away. Any code can run in MATLAB, once it’s saved, by using the Save and Run button in the home tab of MATLAB, or you can simply use the F5 key on your keyboard.

5. What is MATLAB used for?

MATLAB language is a high-level matrix language. It has control structures, functions, data structures, input/ output and OOP features. MATLAB API allows to author C and FORTRAN programs to interact with MATLAB. It is used for various industry level designing processes and for running the control systems, automations of different types of machines, by defining a particular set of codes for an object.

6. How to read csv file in MATLAB ?

CSV stands for Comma-Separated Values. A command called csvread is generally used to read the csv files, but is not actually preferred.

________________________

Syntax : M = csvread(filename)
__________________

The newer version of MATLAB instead recommends readmatrix to read such type of files.

______________________________

Syntax : A = readmatrix(filename)
_______________________

7. Tell me about some tools of MATLAB?

  • LMI control
  • Neural Networks
  • Robust Control
  • System Identification
  • Control System
  • Fuzzy Logic
  • Image Processing
  • LMI control

8. How to comment in MATLAB ?

Comments in MATLAB can be inserted in between the codes. The syntax for comment goes like this:-

________________________

“ % your comment goes here. ”
__________________

9. How to implement neural network in MATLAB ?

A neural network is an adaptive system that learns by using interconnected nodes or neurons in a layered structure that resembles a human brain. A neural network can learn from data, so it can be trained to recognize patterns, classify data, and forecast future events.

It breaks down the input into layers of abstraction. It can be trained using many examples to recognize patterns in speech or images, for example, just as the human brain does. Its behaviour is defined by the way its individual elements are connected and by the strength, or weights, of those connections. With just a few lines of code, MATLAB lets you develop neural networks.

The work flow for the general neural network design process has seven primary steps :-

  • Collect data
  • Create the network
  • Configure the network
  • Initialize the weights and biases
  • Train the network
  • Validate the network (post-training analysis)
  • Use the network

MATLAB and Deep Learning Toolbox provide command-line functions and apps for creating, training, and simulating shallow neural networks. The apps make it easy to develop neural networks for tasks such as classification, regression (including time-series regression), and clustering. After creating your networks in these tools, you can automatically generate MATLAB code to capture your work and automate tasks.

10. How to open SIMULINK in MATLAB ?

SIMULINK can be easily accessed in MATLAB by the use of Home tab. Simply go on the Home tab and click Simulink.

11. How to create GUI in MATLAB ?

Steps to create a GUI :-

  • Start GUIDE by typing guide at the MATLAB prompt.
  • In the GUIDE Quick Start dialog box, select the Blank GUI (Default) template, and then click OK.
  • Display the names of the components in the component palette:
  • Select File > Preferences > GUIDE.
  • Select Show names in component palette.
  • Click OK.

Following the steps, you can start to create a GUI in MATLAB.

12. How to stop a program in MATLAB ?

You can simply use the quit command to stop a program in MATLAB or you can use the desktop shortcut such as Ctrl + C.

13. How to import data from EXCEL in MATLAB ?

You can do this by clicking the Import Data icon under the Home tab and navigating to the Excel file you that want to import. Its just a simple step.

14. How to add toolbox in MATLAB ?

Ans. To create a toolbox installation file :-

  • In the Environment section of the Home tab, select Package Toolbox from the Add-Ons menu.
  • In the Package a Toolbox dialog box, click the ‘plus’ button and select your toolbox folder. It is good practice to create the toolbox package from the folder level above your toolbox folder. The .mltbx toolbox file contains information about the path settings for your toolbox files and folders. By default, any of the included folders and files that are on your path when you create the toolbox appear on their paths after the end users install the toolbox.
  • In the dialog box, add the information about your toolbox such as, ToolBox name, version, Author name, email and Company, ToolBox image, its summary and description.
  • To save your toolbox, click Package at the top of the Package a Toolbox dialog box. Packaging your toolbox generates a .mltbx file in your current MATLAB folder.

15. How to declare array in MATLAB ?

An array can be declared in MATLAB using the following syntax :

________________________________

A = [1 2 3 4 5]
____________________

It creates an array of 1X5.

Or it can be declared in the following syntax :

____________________________

N=[1,2,3,4,5]
___________________

It also creates an array of same 1X5 dimension.

16. How to calculate classification accuracy in MATLAB ?

Here’s one approach we may try:

__________________________________

% output= evalfis( fis, input);

pred = round(output);

acc_count = nnz( pred==input); 

acc = acc_count/length(input);
__________________________

Here we are considering round values of the fuzzy system as the predictions obtained and then counting the number of correct predictions over the total number of inputs.

17. How to generate sine wave in MATLAB ?

A program to generate sine wave in MATLAB is given below :-

____________________

t = 0:0.01:2;

w = 5;

a = 4;

st = a*sin(w*t);

plot(t, st);
__________________

Using this program and altering the values of ‘t’, ‘w’ and ‘a’, we can further generate longer sine waves.

18. How to read audio file in MATLAB ?

Here is the syntax to read audio files in MATLAB :-

_____________________________

[y, Fs] = audioread(filename)
_______________________

x Here it reads data from the file named filename, and returns sampled data, y, and a sample rate for that data, Fs.

19. What is the MATLAB working environment ?

MATLAB working environment has various tools to work with MATLAB. It has facilities to manage variables. MATLAB supports export and import data across applications. Certain tools are available to develop and manage MATLAB files. Debugging and profiling of MATLAB applications are more flexible with MATLAB. It is the blank space in between the functions and command history box where we can write the codes.

20. Explain how polynomials can be expressed in MATLAB ?

There are a number of ways in which a polynomial function can be expressed in MATLAB. Polynomials are equations of a single variable with nonnegative integer exponents. MATLAB represents polynomials with numeric vectors containing the polynomial coefficients ordered by descending power. For example, [1 -4 4] corresponds to x2 – 4x + 4. Some of the functions are :-

Poly, polyeig, polyfit, residue, roots, polyval etc.

 

 

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x