Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Use the documentation links provided to answer the following questions: nthro

ID: 3566354 • Letter: 1

Question

1) Use the documentation links provided to answer the following questions: nthroot documentation: http://www.mathworks.com/help/matlab/ref/nthroot.html length documentation: http://www.mathworks.com/help/matlab/ref/length.html

a) The nthroot function allows one to specify the degree of the root they wish to take (e.g., a cube root would have a degree of 3, square 2, etc.). Write the MATLAB code to take the 5th root of 187.

b) The length function can be used to return the length of a vector. Write the MATLAB code to return the length of a vector x = [1 2 4 5]. What is the output?

c) The load function can be used to import data from a file into a vector. Write the MATLAB code to load a file named

Explanation / Answer

nthroot documentation: http://www.mathworks.com/help/matlab/ref/nthroot.html
length documentation: http://www.mathworks.com/help/matlab/ref/length.html

a) The nthroot function allows one to specify the degree of the root they wish to take (e.g., a cube root would have a degree of 3, square 2, etc.).
Write the MATLAB code to take the 5th root of 187.

nthroot(187, 5)

b) The length function can be used to return the length of a vector. Write the MATLAB code to return the length of a vector x = [1 2 4 5]. What is the output?

length(x)

OUTPUT : 4

c) The load function can be used to import data from a file into a vector. Write the MATLAB code to load a file named "myfile.txt" into a vector.

x = load("myfile.txt");