Introduction to MATLAB (original) (raw)

Last Updated : 17 Sep, 2025

MATLAB ( MATrix LABoratory) is a programming and numeric computing platform developed by MathWorks. It is widely used by engineers, scientists and researchers for solving mathematical problems, analyzing data, developing algorithms and creating models.

matlab

Introduction to MATLAB

Key Features of MATLAB

Simple MATLAB Example

Matlab `

x = 0:1:10; % x values from 0 to 10 y = 2 * x + 1; % y values based on the equation y = 2x + 1

plot(x, y) % Plot the line title('Line Graph of y = 2x + 1') xlabel('X Values') ylabel('Y Values')

`

**Output:

line_graph

Output

**Explanation:

Basic MATLAB Workflow

Using MATLAB usually involves these steps:

  1. **Entering Commands: Use the Command Window to run calculations directly.
  2. **Writing Scripts: Save sequences of commands in .m files for reuse.
  3. **Running Functions: Use built-in or user-defined functions for specific tasks.
  4. **Visualizing Results: Create plots and graphs to analyze data.

MATLAB Library

MATLAB comes with a large set of inbuilt functions. Many are for mathematical operations (like sin, cos, det, inv, dot, cross).

Unlike languages like C or Java, MATLAB does not require:

This makes operations such as vector and matrix computations much simpler, often requiring only a single line of code.

Basic Functions in MATLAB

Function Description
disp() Displays values or text on the screen
clear Clears all variables from the workspace
close all Closes all graphics windows
clc Clears the Command Window
exp(x) Calculates e^x
abs(x) Returns the absolute value of x
sqrt(x) Returns the square root of x
log(x) Calculates natural logarithm (base e) of x
log10(x) Calculates logarithm (base 10) of x
rem(x, y) Returns the remainder of x/y
sin(x) Returns sine of x
cos(x) Returns cosine of x
tan(x) Returns tangent of x
atan2(y, x) Returns arctangent (inverse tangent) of y/x

Applications of MATLAB

MATLAB is used across various engineering, scientific and research fields. Some major application areas include:

To read more about MATLAB, You can refer to - MATLAB Tutorial