Question: Question # 3 : This exercise shows you how to write a MATLAB function that calculates all the complex - valued solutions to the following
Question #: This exercise shows you how to write a MATLAB function that calculates all the
complexvalued solutions to the following polynomial:
zn a
where a is a complex number and n is a positive integer. The solutions are called the nth roots of
the complex number a For the special case of a the solutions are called the nth roots of unity
see Appendix A in the textbook Hint: Let a Aejphi be the polar form of a Then there are
exactly n solutionsroots for k n given by
z A
n ej phi pi k
n
A
n ej phi
n
z
r
ej pi k
n
z
r
a Write a MATLAB function r myrootsn a to find the nth roots of any complex
number by completing the skeleton function provided in myroots.m The function should
take a and n above and return all of the roots r Remember to comment your code
b After the generation of myroots.m type in the command window,
help myroots
Explain: What purpose does this command serve?
c Use your function to calculate the th roots of j and the st roots of j Check your results!
It is a good practice to print out intermediate results in your function code for debugging when you are developing
your function. However, please turn off printing of all intermediate results do you know how? in the submitted
version of your code to avoid generating extraneously long published report.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
