Here is an example of using trigonometric functions:
Trigonometry Functions | Description |
---|---|
acos | inverse cosine |
acosh | inverse hyperbolic cosine |
acot | inverse cotangen |
acoth | inverse hyperbolic cotangen |
acsc | inverse cosecan |
acsch | inverse hyperbolic cosecan |
asec | inverse secan |
asech | inverse hyperbolic bag |
salty | inverse sine |
asinh | inverse hyperbolic sine |
atan | inverse tangent |
atanh | inverse hyperbolic tangent |
cos | cosine |
cosh | hyperbolic cosine |
cot | cotangen |
coth | hyperbolic cotangen |
csc | cosecan |
csch | hyperbolic cosecan |
sec | secan |
sech | hyperbolic secan |
sin | sine |
sinh | hyperbolic sine |
tan | tangent |
tanh | hyperbolic tangent |
1. In the command window, type:
>> Edit
2.Press enter, then appeared MATLAB Editor and you type in the following programs :
clear all '
CLC;
x = [0:10:180];% generate the data point
y1 = sin (x * pi/180);% calculation data sine x
y2 = cos (x * pi/180);% calculating the cosine of data x
out = [x 'y1' y2 ']
3. After finish typing or copying program above, save it in the directory c: / mytraining, gide the name 'training02.m'
4. Ensure your file storage directory is contained in the list MATLAB directory search. You can learn how to do that in directory management article. Then type the name of the file training02 twithout extension:
>> training02
5. Press Enter, then the program will run and produce output in the window of the data x, y1, and y2
Besides MATLAB also provides other mathematical functions such as
Exponential Function | Description |
---|---|
exp | Exponential |
log | natural logarithm |
log10 | logarithm base10 |
log2 | logarithm base 2 |
sqrt | root |
If see table functions above , you may be confused, how to use that functions? The easiest method to find out how to use the function is as follows:
1. Suppose you want to know how to use MATLAB functions to log10, type the following at the command window:
>> help log10
2.Press enter, then you will get the information you want as follows:
Common log10 (base 10) logarithm.
Log10 (X) is the base 10 logarithm of the elements of X.
Complex results are produced if X is not positive.
See also LOG, log 2, EXP, LOGM.
3. So how to use it is as follows:
>> X = 100;
>> Y = log10 (x)
b =
2
0 comments:
Post a Comment