0% found this document useful (0 votes)
41 views3 pages

MATLAB Basics and Advanced Techniques

This document provides an overview of MATLAB including: 1) Key concepts in Part A such as variables, in-built functions like who and whos, matrices, plotting data, strings, and relational operators. 2) Details on common MATLAB functions in Part B including root finding, curve fitting, integration, solving ODEs, and linear systems. 3) Helpful notes on topics like the colon operator, linspace, logspace, limitations, and common mistakes.

Uploaded by

Nilana
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)
41 views3 pages

MATLAB Basics and Advanced Techniques

This document provides an overview of MATLAB including: 1) Key concepts in Part A such as variables, in-built functions like who and whos, matrices, plotting data, strings, and relational operators. 2) Details on common MATLAB functions in Part B including root finding, curve fitting, integration, solving ODEs, and linear systems. 3) Helpful notes on topics like the colon operator, linspace, logspace, limitations, and common mistakes.

Uploaded by

Nilana
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
You are on page 1/ 3

Author: Spencer Haymes

ENG1060 Notes
Contents
Part A – Understanding MATLAB • Logical function and operators 16
• If statements 17
• Variables 2
• For loops 18
• Warnings 2
• While loops 18
• In-built functions 2
• Break and continue commands 19
o Who
• Switch 20
o Whos
• Find 20
o Dir
o Colon operator : • Pseudocode 21
o Linspace • Variable scope 21
o Logspace • Function handles 21
o Max and min • Sub-functions 22
o Sum • Nested functions 22
o Input • Data types 23
o Pause • Efficient coding 23
o Display • Good programming practice 23
o Exist • Format command 23
o fzero
Part B – Using MATLAB
o Trig functions
o Mod • Root finding 24
o Rem o Bracketing methods
o Round/ceil/floor o Open methods
o Rand o MATLAB methods
o Unique • Curve fitting 29
o Sign o Coefficient of determination
o Sort o Non-linear regression
o Binary and decimal o In-built MATLAB functions
• Limitations 7 • Integration 32
• Keyboard shortcuts 8 o Trapezoidal rule
• Matrices 8 o Simpson’s 1/3rd rule
• Plotting data 9 o Simpson’s 3/8th rule
• Functions 11 o MATLAB functions
• Strings 12 • ODE’s 36
• fprintf 12 o Euler’s method
• sprint 13 o Heun’s method
• Saving data and documents 13 o Midpoint method
• Importing 13 o MATLAB ODE solvers
• Exporting 14 • Linear systems 38
• Relational operators 15 • Common mistakes 39

1
Author: Spencer Haymes

Part A
Variables

Variable naming rules

• MUST start with a letter


o No number at the start
• No special characters allowed
• No foreign characters
• No blank spaces
• Underscores (and numbers) are okay, but not as the first character
• Variables are case sensitive

Warnings

• Unsuppressed outputs
• Undefined variables
• Pre-allocating (matrix changing size)
• Polyfit degree too high

In-built functions

who: Lists existing variables

whos: Lists existing variables and properties

dir: lists files and folders in the current directory

2
Author: Spencer Haymes

Colon operator :

• Creates a vector with equally spaced values using a specified spacing step


• Limitations

o
• To create column vectors

o
• Using negatives

o
Linspace

• Creates a vector with equally spaced values using a specified number of points


• Using negatives

o
Logspace

• Similar to linspace


• Default of 50 points if not specified

You might also like