0% found this document useful (0 votes)
33 views2 pages

MATLAB Part1 Basics

Uploaded by

mohdubaidamu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

MATLAB Part1 Basics

Uploaded by

mohdubaidamu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MATLAB for Petrochemical Engineering

Part 1: Basics of MATLAB

Chapter 1: Introduction to MATLAB Interface

MATLAB (Matrix Laboratory) is a high-level language and interactive environment for numerical computation,

visualization, and programming. The interface includes the Command Window, Workspace, Editor, and

Figure Window.

Chapter 2: Basic Commands, Variables, and Data Types

Basic commands include clc (clear command window), clear (clear variables), and who/whos (list variables).

Variables can be scalars, vectors, or matrices. Data types include double, char, logical, etc.

Chapter 3: Arrays, Matrices & Matrix Operations

Arrays and matrices are fundamental in MATLAB. Use square brackets [] to create them. Operations include

addition, subtraction, multiplication (*), element-wise multiplication (.*), transpose (') and inverse (inv()).

Chapter 4: Plotting and Visualization (2D, 3D plots)

MATLAB supports various types of plots: plot(x, y) for 2D, plot3(x, y, z) for 3D, and surf(X, Y, Z) for surface

plots. Use xlabel, ylabel, title, legend for annotation.

Chapter 5: Scripts and Functions

Scripts are files with a sequence of MATLAB commands saved as .m files. Functions are defined using the

'function' keyword and allow input/output arguments, making code reusable.

Chapter 6: Logical Operations and Loops

Logical operators include <, >, ==, ~=, &, |. Loops include for loops and while loops for repetitive tasks.

Conditional execution uses if, else, elseif statements.


MATLAB for Petrochemical Engineering
Part 1: Basics of MATLAB

Chapter 7: File Handling and Importing Data (Excel, CSV)

MATLAB can read files using functions like readmatrix, xlsread, and csvread. Use fopen, fprintf, and fclose

for manual file operations.

You might also like