Matlab Notes 2
Matlab Notes 2
Part 2
Luke Dickens
Input/Output
Applications
Non-Array Types
Final Remarks
Reminder
Input/Output
Applications
Non-Array Types
Final Remarks
save and load
The commands save and load can be used to save and load
variables in files called a Mat-files. Mat-files are binary format and
always have the .mat extension. Examples of usage are below:
The command load can also be used to load ASCII data files,
provided the data file contains only a rectangular matrix of numbers.
Data can be imported from a variety of file formats, e.g.
Input/Output
Applications
Non-Array Types
Final Remarks
M-files
Another useful form of flow control is the if block. This has the
form
if (boolean_statement)
...
elseif (another_boolean_statement)
...
else
...
end
for j = 1 : n
for k = 1 : n
if (x( j , k ) > 0.5)
x( j , k ) = 1.5;
end
end
end
Indentations are for clarity only.
Scripts
function [] = funcplot(fhandle,xcoords)
% Takes function handle and list of x-coordinates
% and plots curve of function
plot(xcoords,fhandle(xcoords))
Input/Output
Applications
Non-Array Types
Final Remarks
Applications
y = ak x k + ak −1 x k −1 + . . . + a2 x 2 + a1 + a0
To illustrate this, we create some noisy data then try to fit it.
Input/Output
Applications
Non-Array Types
Final Remarks
Cells
Input/Output
Applications
Non-Array Types
Final Remarks
Summary
MATLAB Help
http://www.mathworks.com/help/
MATLAB Suppport
http://www.mathworks.com/support/
The above web page includes a link to MATLAB based books.
See also
http://www.mathworks.com/support/books/index.jsp
Or contact me at:
[email protected]
References