Write a function in Matlab that takes as input the number n, the size of matrice
ID: 3786175 • Letter: W
Question
Write a function in Matlab that takes as input the number n, the size of matrices and vectors; m, the number of nonzero elements of a sparse matrix; and the sparse matrix whose nonzeros are given in m-component column vectors r, c, and v: the r_k row, c_k column entry of the matrix is nonzero with value v_k, for k = 1, ..., m. Finish the program in the following way: Have the function output the actual n times n matrix A represented. Write out or print out your function. Have the function accept also the input of x, an n-component vector, and, working directly with the r, c, and v, output the matrix-vector multiplication between the sparse matrix and the vector x, and the number of flops involved. Write out or print out your function. Assuming the sparse matrix is lower triangular and c is in non-decreasing order, have the function accept also the input of b, an n-component vector, and, working directly with the r, c, and v, output column-oriented forward substitution solving for A^-1b, and the number of flops involved. Write out or print out your function.Explanation / Answer
Request a numeric input, and then multiply the input by 10.
At the prompt, enter a numeric value or array, such as 42.
The input function also accepts expressions. For example, rerun the code.
At the prompt, enter magic(3).
Request Unprocessed Text Input
Request a simple text response that requires no evaluation.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.