Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about Calculating Values of Trigonometric Functions in MATLAB. Trigonometric function have a great importance in latest mathematics. There are six types of trigonometric functions out of which first three are used more frequently in comparison to the other three. Trigonometric functions are important in the study of triangles.
Trigonometric functions show the relationship between the angles of the triangle and the lengths of its sides. The positive and negative signs with the trigonometric functions indicate the portion of the quadrants. Well known theorem of mathematics i.e. Pythagoras Theorem is used in case of the right angle triangle and is totally based on the first three trigonometric functions.
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.
Suppose there is a particular angle θ then all of these functions can be written in MATLAB as shown below.
- 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.
So, that is all from the tutorial Calculating Values of trigonometric Functions in MATLAB. I hope you enjoyed this tutorial. If you face any sort of problem you can ask me in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will explain you that how to Plot Simple Signal in MATLAB. I will explore MATLAB further in my later tutorials and will share all of them with all of you as well. So, till then, Take Care 🙂