Documente Academic
Documente Profesional
Documente Cultură
Delivered by
A. K. Bhattacharyya
Senior Project Assistant
Department of Electrical Engineering
IIT Kharagpur
n=10;
factorial=1;
for i=1:1:n
factorial=factorial*i;
end
• edit fact.m
• List the
names of
the files in
your
current
directory:
what
function yp = myfunction(y)
%The function you want to check.
global ALPHA
yp = [y-ALPHA*y];
global ALPHA
ALPHA = 0.01
y=myfunction(1:10);
• pi: 3.1415926535897...
+ Addition
- Subtraction
.* Multiplication
./ Right division
.\ Left division
+ Unary plus
Operator Description
~= Not equal to
• Perform
element-wise
logical
operations on
their inputs to
produce a like-
sized output
array.
A and b
must have
equal
dimensions
, with each
dimension
being the
same size.
if ((A==10)||(B==20))
…..
end
switch can
handle multiple
conditions in a
single case
statement by
enclosing the
case
expression in a
cell array.
save
•Saves workspace variables on disk.
•As an alternative to the save function,
select Save Workspace As from the File
menu in the MATLAB desktop, or use the
Workspace browser.
Syntax
• save
• save filename
• save filename var1 var2 ...
• save('filename', ...)
Description
• save by itself, stores all workspace variables in a
binary format in the current directory in a file
named matlab.mat. Retrieve the data with load.
MATLAB orientation course: Organized by FOCUS – R&D
File Handling