BASIC INTRODUCTION TO MATLAB
Basic Arithmetic
Trigonometry
Logarithms and Exponentials
Variables
Retrieving Variable Values
Saving and Loading
Recording Your Steps
Helpful Links
Trigonometry
How to
Examples
How to:
All of the trigonometry functions are easily accessed within MATLAB. To take the function of some variable x:
sine - sin(x)
cosine - cos(x)
tangent - tan(x)
cotangent - cot(x)
secant - sec(x)
cosecant - csc(x)
The inverse (arc-) trig. functions are just as easy:
arc-sine - asin(x)
arc-cosine - acos(x)
arc-tangent - atan(x)
arc-cotangent - acot(x)
arc-secant - asec(x)
arc-cosecant - acsc(x)
And, if we are going to be dealing with trig. functions, we are going to need an accurate way to represent "pi." Luckily, MATLAB has made it so we simply need only type
pi
to use it.
Examples:
Let's find the value of tangent of 45 degrees. Angle measurements in MATLAB must be given in radians, and not degrees:
tan(pi/4)
Now, let's find the inverse cosine of (the square root of 3) divided by 2:
acos(sqrt(3)/2)
You'll notice that MATLAB returns a value of .5235... and not pi/6 like you may have expected. This is the computed value of pi/6. MATLAB does not recognize our "special angles" in trigonometry. You will have to rely on yourself to recognize them.