MATLAB Answers

# mathematical equation in matlab

6 views (last 30 days)
Shehab Tarek on 8 Jun 2020
Commented: madhan ravi on 8 Jun 2020
how to write this equation in matlab
angle=tan(2*pi*0.25) but i want it in radian form
i know its equal 1/0
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

madhan ravi on 8 Jun 2020
Angle = tan(sym((2*pi*0.25)))
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### More Answers (1)

Walter Roberson on 8 Jun 2020
angle = sinpi(2*0.25) / cospi(2*0.25)
That is, there is no tanpi() function but there is a sinpi() and cospi() that are intended to be more accurate for these kinds of boundary cases.
If you have the symbolic toolbox you could also
Pi = sym(pi); %specially recognized
angle = tan(2 * Pi * 0.25)
##### 1 CommentShowHide None
madhan ravi on 8 Jun 2020
Also better is to not name a variable angle because there's an inbuilt function named angle(...)

Sign in to comment.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!