Calculating trigonometric Functions in MATLAB

Calculating trigonometric Functions in MATLAB
Here in the tutorial Calculating Values of trigonometric Functions in MATLAB, I will explain you that how can you calculate the values of trigonometric functions in MATLAB. First of all I would like to explain a bit about the trigonometric functions. They are important in the studies of triangles and depend upon some particular angle, as I have told earlier. There six types of trigonometric functions and they are given below.- sine
- cosine
- tangent
- cosecant
- secant
- cotangent
- sin?
- cos?
- tan?
- cosec?
- sec?
- cot?
Calculating Values
- Here I am going to calculate the values of the trigonometric functions in editor of the MATLAB.
- First of all open the MATLAB software and open the editor then.
- You need to define a time duration in which the function is defined.
- Set the frequency of sinusoidal signal and write the function to calculate the value.
- All of the above steps are shown in the figure below.
- In the above figure you can see that I have define the duration from 0 to
- I have adjusted the frequency of the signal as 5Hz.
- And then I have written the desired function to calculate its value.
- Since, I want to observe its value on the command window so I have removed the semicolon at the end of this statement as shown in the figure above.
- The result displayed on the command window is shown in the figure below.
- Similarly you can also calculate the values of all of the other trigonometric functions.
- Here I am going to calculate the values of cosine and tangent functions for the same time duration and same frequency as well.
- The code for calculating the values of the cosine and tangent functions is shown in the figure below.
- You can see that there is no semicolon at the end of the last three statements because I want to observe the results of these three statements on the command window, if I put a semicolon, there will appear nothing on the command window then.
- The results shown in the command window are shown in the figure below.
- By scrolling up you can also observe the result of the sine function.
×
![]()





































































