Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question # 3 : This exercise shows you how to write a MATLAB function that calculates all the complex - valued solutions to the following

Question #3: This exercise shows you how to write a MATLAB function that calculates all the
complex-valued 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 =1, the solutions are called the nth roots of unity
(see Appendix A in the textbook). Hint: Let a = Aej\phi be the polar form of a. Then there are
exactly n solutions/roots, for k =0,1,..., n 1, given by
z = A 1
n ej \phi +2\pi k
n =
A 1
n ej \phi
n
|{z }
r1
ej 2\pi k
n
|{z }
r2
,
(a) Write a MATLAB function r = myroots(n, 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.1
(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 7th roots of j and the 21st roots of j. Check your results!
1It 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.
8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions