First, find the n nth roots of unity.
eg if n = 6, find the n distinct (complex) numbers such that n^6 = 1.
Second, raise each root to the power pi (.^pi).
Third, sum the resulting numbers and use that as the output.
Surely I shouldn't done this ugly string thing, that is bad for everyone. Without any doubt, Tim's solution is the best one
Solve the set of simultaneous linear equations
05 - Vector Equations 2
Help the Patriots get to the Super Bowl
Divide by 4
Replace values under a limit
Find left eigenvector of row stochastic matrix
Find argmax of a function
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office