Professional Documents
Culture Documents
: MATLAB
(Workspace (
-m
: MATLAB
-1-1
Command window :
Command History :
Current Directory :
Work Space :
Start
: MATLAB
: MATLAB
Command Window :
: MATLAB
Command History :
.
: MATLAB
Current Directory :
.
)
(
: MATLAB
Work Space :
: MATLAB
-1-2
: :
:
>> 4*25 + 6*22 + 2*99
=ans
430
: MATLAB
-1-2
: :
:
;>>a=25
;>>b=22; c=99
>>d=4*a+6*b+2*c
=d
430
>>
:1 ; ,
:2
:3
: MATLAB
-1-3 :
^\/,*,-,+,
:
>>5^2
=ans
25
/ \ / . \ .
56/8 56\8 .
- + < * \ / < ^ :
: MATLAB
-1-4 Work space
.
.
.
.
.
: MATLAB
-1-4 Work space
:
:
who whos
: save load
: MATLAB
-1-4-1
:
: clear
>> clear
>> clear a b c
: MATLAB
-1-4-2 who whos
( ( .
>> who
Your variables are:
abc
Size
Bytes Class
8 double array
8 double array
8 double array
>> whos
Name
1x1
1x1
1x1
a
b
c
: workspace whos
.
: MATLAB
-1-4-3 : save :load
save . load
.
:
;>>a=5; b=4; c=7
;>>save c:\myfile.mat a c
>>clear
>>a
??? Undefined function or variable 'a
>> load c:\myfile.mat
>>a
=a
5
>>b
??? Undefined function or variable 'a
: MATLAB
-1-4-3 : save :load
save load :
]save [filename] [variables
]Load [filename] [variables
. matlab.mat
.
: MATLAB
-1-5 ( (Format
.
]>>Format [option
Option: short, long, short e, long e, short g, long g, hex,
+,
: MATLAB
-1-6
: ( 8( double
struct :
: ( 4(single
uint8
8 :
16uint16 :
uint32 :
32
64 uint64 :
int8
8 :
int16
16 :
int32
32 :
int64
64 :
help datatypes
: MATLAB
: MATLAB
-1-6
.
:
;)a=TypeName(a
. 8 ;)>> a=uint8(a
>> b = uint32(345); 32
:
.
:
)>> intmin(int16
)>> intmax(int16
: uint8.
: MATLAB
-1-7
: _
: namelengthmax
MATLAB . 2006 63 .
MATLAB
.
which all varName
:
;>>This_Is_a_Variable=5
: MATLAB
-1-8
.
NaN
nargin
i
nargout
j
ans
pi
eps
inf
: MATLAB
-1-9
% .
>> a=5; %a is a variable
...
:
>> b=a+a^2+
;3*a^3
: MATLAB
-1-10
i j
:
;>>c=1-2i
;)>>k=(-1)^(1/2
;>>c=1-2j
;>>c=1-2*k
;>>c=1-2*j
:
abs angle
real imag
MATLAB :
-1-11
log10
abs conj
acos exp real
asin fix imag
acosh
round
rem(x,y)
asinh
gcd(x,y) sign
atan lcm(x,y) sqrt
atanh
log
: MATLAB
-1-12
start .
demo
help
lookfor
: MATLAB
-1-13 ( (Script m
.
m.
: MATLAB
-1-13-1
.1 :
File>New>m-file
.2
.3 :
File>Save As
: MATLAB
-1-13-2
Enter .
: ( (m
.
: sample1.m
: MATLAB
-1-13-3 m
.1 ) :disp(x
.
:
;>> n=10
)>>disp(n
10
)>> disp(This is a string
This is a string
: MATLAB
-1-13-4 m
.2 ) :x=input(s .
:
) n=input(Please tell me n value:
-------------------------------------------------Please tell me n value: 10
=n
10
MATLAB :
m -1-13-4
. :pause
pause
pause(n) % n seconds
:
%SAMPLE2: Enhanced Sample1
n=10;
a=input( a value= );
b=input( b value= );
c=n*a^3/b + 3*n*a^2/b^2 + 6*n*a/b^3;
disp(Please wait 5 seconds only!);pause(5);
disp(Press any key to see answer.); pause;
disp( C Value is= ); disp(c)
.3
: MATLAB
:1-1
x .
y .
;y=x^3 + 3*x^2 +6*x + 6
MATLAB
.
MATLAB
trace.
: MATLAB
-1-14 :
:
:cd :
>>cd
C:\Matlab\Work
>>cd C:\MyDir
>>cd
C:\MyDir
:dir
:delete( ( :
>>delete sample1