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
Select every other element of a vector
Output any real number that is neither positive nor negative
Create sequnce 1 4 9 16 25.........
Find argmax of a function
Find left eigenvector of row stochastic matrix
Calculating large fibonacci numbers
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