MATLAB (MATrix LABoratory) is a multi-paradigm numerical computing environment. It is a high-level programming language. A proprietary programming language developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, C#, Java, Fortran and Python.
Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing abilities. An additional package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic and embedded systems
MATLAB (Matrix Laboratory) is a high-performance programming language for technical computing. It is a fourth-generation programming language and numerical analysis environment. It integrates computation (IDE), visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include: Matlab in not only a programming language, but a programming environment as well. It is very good at performing matrix operations, making it useful for things like image operations and control system analysis. It is very quick to develop code in Matlab. Many libraries (e.g. computer vision, signal analysis, GUI tools) are part of the Matlab ecosystem. This saves developers the time of installing and configuring new libraries to perform whatever tasks they have in mind. Instead, developers can quickly get an idea and try it out in code using the vast functionality of Matlab’s libraries. One more thing that Matlab really excels at is its plotting functions. Matlab offers a variety of ways to visually display data. Furthermore, most of the plotting functions are very user-friendly and configuring the plots to look exactly as you would like is very easy to do. GNU Octave is software featuring a high-level programming language, primarily intended for numerical computations. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with Matlab. It may also be used as a batch-oriented language. Xmath is an interactive scripting and graphics environment for Xwindow workstations. With its significant improvement features on MATLAB¬type software, interactive mathematics,scripting functionalities are elaborated. Following are the Xmath features: The MEX file contains only one function or subroutine, and its name is the MEX file name. To call a MEX file, use the name of the file, without the file extension. The term mex stands for “MATLAB executable” and has different meanings, as shown in the following. MEX Term source MEX file: C, C++, or Fortran source code file. binary MEX file: Dynamically linked subroutine executed in the MATLAB environment. MEX function library: MATLAB C and Fortran API Reference library to perform operations in the MATLAB environment. mex build script: MATLAB function to create a binary file from a source file. MATLAB Language 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. MATLAB supports export and import data across applications. Matlab Working Environment 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. Note that the Matlab environment is highly configurable, which means that it may not look exactly like this on your machine. (You can try selecting Desktop Desktop Layout -> Default from the menubar, but that may still not give you this exact configuration, depending on your particular version.) Simulink is a simulation and model-based design environment for dynamic and embedded systems, integrated with MATLAB. Simulink, also developed by MathWorks, is a data flow graphical programming language tool for modelling, simulating and analyzing multi-domain dynamic systems. Simulink is a graphical block diagramming tool with customizable set of block libraries Simulink supports: MATLAB provides a set of low-level functions that allows you to create and manipulate lines, surfaces, and other graphics objects. This system is called Handle Graphics. Most code written for numeric handles still works with object handles. For example, you can access graphics object properties and you can combine graphics objects into arrays, even if the objects belong to different classes Graphics functions include 2-D and 3-D plotting functions to visualize data and communicate results. Customize plots either interactively or programmatically. MATLAB API is a library that allows you to write C and FORTRAN programs that interact with MATLAB. It includes facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing MAT-files. Script: The simplest type of MATLAB program is called a script. A script is a file with a .m extension that contains multiple sequential lines of MATLAB commands and function calls. You can run a script by typing its name at the command line. A script is simply a collection of Matlab commands in an m-file (a text file whose name ends in the extension “.m”). Upon typing the name of the file (without the extension), those commands are executed as if they had been entered at the keyboard Functions: Functions operate on variables within their own workspace, which is also called the local workspace, separate from the workspace you access at the MATLAB command prompt which is called the base workspace. Functions can accept more than one input arguments and may return more than one output arguments. Syntax: function [out1, out2… outN] = myfun(in1,in2,in3, …, inN) MATLAB Mathematical Function Library 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. Matlab already handles naturally simple LaTeX encodings that allow introducing Greek lettters or modifying the font size and appearance in plots LaTeX form of symbolic expressioncollapse all in page. Syntax: latex(S) returns the LaTeX form of the symbolic expression S. By default, the code is saved in (.m) extension, which is secured but if the user wants it to be stored in a more secured way then he can try the following methods: Make it as P-code: Convert some or all of your source code files to a content-obscured form called a P-code file (from its .p file extension), and distribute your application code in this format. Compile into binary format: Compile your source code files using the MATLAB Compiler to produce a standalone application. Distribute the latter to end users of your application. P-code files are purposely obscured; they offer a secure means of distribution outside of your organization. Pcode is a preparsed and encoded version of the M-file. It saves on the load time of the function. This is most likely not an issue except for very large M-files, since most are parsed only once anyway. Pcode also lets you hide the source code from others. There is no way to convert Pcode back to the M-file source. Pcode is platform independent. Following functions can be used to read a text file: DLMREAD: It allows you to read files with fields delimited by any character. TEXTREAD: It allows you to skip lines at the beginning, ignore certain comment lines, read text as well as numbers, and more. myfile.txt: It is for the file which has nothing but numbers separated by space, and has a constant number of columns through the entire file. Other functions are FOPEN, FREAD, FSCANF, FGETL, FSEEK and FCLOSE. Interpolation can be defined as taking out function values between different data points in an array whereas finding function values beyond the endpoints in an array is called extrapolation. Commonly both can be done by using nearby function values to define a polynomial approximation to the function that is good over a small region. There are two types of Interpolation and Extrapolation: MATLAB is used in aerospace engineering, space environment. MATLAB is suitable for flexible dynamics. These domain experts conduct stress analysis on various structures like metallic and composite structures. To analyze the stress, NASTRAN, IDEAD, Oracle and PATRAN levels of proficiency is needed. The tasks are also used on aircraft that is metallic structure. The stress analysis includes control surface stiffness understanding, loop calculations, finite element modeling and fatigue testing requirement and analysis. General fits which are fitted by giving a decent initial guess for fitting parameters in it is done by fminsearch which is a multidimensional minimizer routine. Suppose we have a set of data points (xj , yj) and a proposed fitting function of the form y = f(x, a1, a2, a3, …). For example: we could try to fit to an exponential function With two adjustable parameters a1 and a2 as is done in the example in leastsq.m below: f(x, a1, a2) = a1ea2x Or we could fit to a cubic polynomial in x2 with four adjustable parameters a1, a2, a3, a4 with this f: f(x, a1, a2, a3, a4) = a1 + a2x2 + a3x4 + a4x6 Functions are those functions which do not really do math but are useful in programming. Some functions are mentioned below: clc : this is clears the command window; useful for beautifying printed output ceil(x) : This is the nearest integer to x looking toward +1 close 3 : This is closes figure window 3 fliplr(A): This is flip a matrix A, left for right fix(x) : This is the nearest integer to x looking toward zero floor(x) : This is the nearest integer to x looking toward -1 length(a) : This is the number of elements in a vector rem(x,y): This is the integer remainder of x/y; see online help if x or y are negative mod(x,y): This is the integer remainder of x/y; see online help if x or y are negative Preallocating a block of memory for holding a non double matrix is memory efficient. It is faster to use the function ‘repmat’. While allocating block of memory for a matrix, zeros are pre allocated to a matrix. The function to pre allocate memory is int8(). Ex: matrix = int8(zeros(100)); Repmat function is used to create a single double matrix. Ex: matrix2 = repmat(int8(0), 100, 100); Thus, non-double matrix is pre allocated. Log and semi-log plots are plotted with the help of semilogx, semilogy, and loglog commands. Some of the common toolboxes in Matlab are To modify the MatLab Path use the PathTool GUI. Also, you can use add path directories from the command line and add the path to rc to write the current path back to ‘pathdef.m.’ In the case if you don’t have permission to write for ‘pathdef.m’ then pathrc can be written into a different file, you can execute from your ‘startup.m.’ This can be done from the command line or from a makefile. You need a script (filename.m). Just type at the command line or include in the makefile: matlab<filename.m where filename.m can write to disk a figure, a binary, an ascii file, anything you want. A polynomial in MatLab is denoted by a vector. To create a polynomial in MatLab enter each co-efficient of the polynomial into the vector in descending order Pseudo random binary sequence: A form of generating an M-file in the new Frequency Domain System Identification Toolbox, for a specified set of lengths (2^2-1 to 2^30-1) is called pseudo random binary sequence. It is also known as mlbs (for Maximum Length Binary Sequence). Numeric precision: Numeric quantities which are represented as double precision floating point numbers is called numeric precision. On most computers, such numbers have 53 significant binary bits, which is about 15 or 16 decimal digits. Below is the list of memory management functions. Clear: Removes variables from memory. Save: Selectively persists variables to disk. Pack: Saves the existing variables to disk, and then reloads them contiguously. Load: Reloads a data file saved with the save function. Quit: Exits MATLAB and returns all allocated memory to the system. The functions such as rand and randn used to model AWGN channel. The function ‘randn’ generates random numbers with normal distribution with mean value equal to zero and variance value of one. The function ‘rand’ generatea random numbers with uniform distribution. These are used in AWGN function of matlab. MATLAB Pros: MATLAB Cons: What is MATLAB?
Why MATLAB?
What is GNU Octave?
What is Xmath?
What’s New in MATLAB R2017?
Can you explain MEXfile in MATLAB?
What are the main system parts of MATLAB?
Can you explain MATLAB LANGUAGE?
Can you explain MATLAB Working Environment?
Can you explain Simulink?
Can you explain Graphics handler?
Can you explain MATLAB Application Program Interface (API)?
Can you explain Script and Functions?
Can you explain MATLAB Mathematical Function Library?
Can you define Latex in MATLAB?
How the source code can be protected in Matlab?
Can you define a P-code?
Explain the functions used to read text files from a certain format in Matlab?
Can you define Interpolation and extrapolation in Matlab?
What is stress analysis in MATLAB?
Can you explain fminsearch?
Can you explain housekeeping functions in MATLAB?
Do you know how to pre allocate a non-double matrix?
How Logarithmic plots can be plotted in Matlab?
What are the common toolboxes present in Matlab?
How to modify the MatLab Path?
How to call matlab in batch mode?
How polynomials can be represented in MatLab?
Can you explain pseudo random binary sequence and numeric precision in matlab?
What is memory management functions in MATLAB?
If one is appearing for Digital Signal Processing (DSP) position, he may often be asked what is the difference between rand and randn ?
What are the pros and cons of MATLAB?
Related posts:
- Basic R Programming Examples With Output
- C Programming Interview Questions and Answers
- Dart Programming Interview Questions and Answers
- Perl Interview Questions and Answers
- Python Interview Questions and Answers
- R Programming Interview Questions and Answers
- Ruby Programming Interview Questions and Answers
- Swift Programming Interview Questions and Answers