Question: Vandermonde Matrix (create from input vector) My Solutions > The mxn Vandermonde matrix is defined in terms of an m element vector x by 1



Vandermonde Matrix (create from input vector) My Solutions > The mxn Vandermonde matrix is defined in terms of an m element vector x by 1 X2 X3... 1. Write a function named vandermondeMatrix that accepts the following two inputs (in order): 1. A column vector x with m elements, 2. A scalar n that gives the number of columns in the matrix. The highest power of x in the right most column is n-1. The function should return a single output: the mxn Vandermonde matrix for the given values of the inputs. For example, if the function inputs are x = [1; 2; 5; 10] and n = 4, then the resulting Vandermonde matrix output would be: 1 1 4 8 125 (1 10 100 1000 Do not use the built-in vander function i your solution- create the output matrix using a loop or other means. Note the function command is given in line 1 with suggested names for the input and output variables. You can change the names (but not the order) of these variables if you like. Do not change the name of the function, however, as this exact name is required for the tests to run. Be sure to assign a value to the output variable. Function Save C Reset MATLAB Documentation 1 function V = vandermondeMatrix(x, n) 2 %V = vandermondeMatrix(x, n) 3 % 4 %generates the m x n Vandermonde matrix, V for a vector, x, where m is the 5 %number of elements in x 6 V = ones (length(x),n); % not sure what 'ones' does? Try it in Matlab 7 Code to call your function C Reset 1 x = [1; 2; 5; 10); 2 n = 4; 3 V = vandermondeMatrix(x, n) 4 Assessment: Run Pretest ? Submit > Is output correct for the values in the Code to Call Your Function example? (Pretest) Is output correct for a 3x3 matrix of hidden values? Is output correct for a 6x5 matrix including non-integer and negative values ? Was the VANDER function used in the solution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
