Useful functions and operations in Matlab
Using Matlab as a calculator is easy.Example: Compute 5 sin(2.53-pi)+1/75. In Matlab this is done by simply typing
5*sin(2.5^(3-pi))+1/75
at the prompt. Be careful with parantheses and don't forget to type * whenever you multiply!
Note that Matlab is case sensitive. This means that Matlab knows a difference between letters written as lower and upper case letters. For example, Matlab will understand sin(2) but will not understand Sin(2).
Here is a table of useful operations, functions and constants in Matlab.
Operation, function or constant | Matlab command |
---|---|
+ (addition) | + |
- (subtraction) | - |
× (multiplication) | * |
/ (division) | / |
|x| (absolute value of x) | abs(x) |
square root of x | sqrt(x) |
ex | exp(x) |
ln x (natural log) | log(x) |
log10 x (base 10 log) | log10(x) |
sin x | sin(x) |
cos x | cos(x) |
tan x | tan(x) |
cot x | cot(x) |
arcsin x | asin(x) |
arccos x | acos(x) |
arctan x | atan(x) |
arccot x | acot(x) |
n! (n factorial) | gamma(n+1) |
e (2.71828...) | exp(1) |
3.14159265... | pi |
i (imaginary unit, sqrt(-1)) | i |
No comments:
Post a Comment