Anda di halaman 1dari 10

MATLAB

To suppress echo, end the line with semicolon

to clear a specific variable

Concatenation- vertical and horizontal


Lecture 1.2 at 7min

Colon notation
Getting sub-arrays
Array Building Functions

Matrix Operations v/s scalar operations


.(operation)
Question-
https://www.youtube.com/watch?v=vL4IcyC7WDU&index=1&list=PLC
RjYf44Mmbohf1r2JxAHD2g_ssWFLWKp#t=222.9326948

Loops

Examples solved
Lecture-1.4
Scripts and Functions
MATLAB files are of 2 types
Scripts
Functions

A script file

A function file always starts with line-


function [out1, out2]= myFunctionName (in1, int 2)
if it doesnt have the output variables or input variables or both, then it looks like
this
function myFunctionName (in1, int 2)
function [out1, out2]= myFunctionName
function myFunctionName
Lecture-1.5

Displaying string on the screen


num2str(int1) is a function which is used to convert integers to string or numbers
to string.

here myFact = 720


If i dont want that ans=, then disp function is used.

Using plot command in various ways

hold on;
This command is used to retain the previous curves on the graph window. If we
dont use this command and call plot function again, the previous plot will be
overridden.

We dont have to type this command again and again. Type only once and then
every time I call plot, all previous curves will be retained.

Lecture-2.1

Errors
o Truncation Errors
o Round-off errors
Machine precision
Every machine has a certain precision. Precision is similar to
least count of a machine. A rule has a least count of 1mm and
a Vernier caliper has a least count of .1mm or 0.01cm. So it
has a better precision. Often precision and the least count are
used interchangeably.
Similarly, a computer has a certain precision. This means that
between number k and k+, no number exists. Machine
precision depends on the number of bytes we use to store a
real number.
A standard real number uses 4 bytes. A double precision uses
8 bytes for its storage. So it will have a better precision.
For more info, look for Computational Techniques course.

In MATLAB, the machine precision is given by esp. The mantissa has 52 bits in it.
The precision is 2*10^-52
Lecture-2.2 (not clear)

Anda mungkin juga menyukai