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

You are given the matrix equation Ax= b, where A= 10 1 0 0 0 1 10 1 0 0 0 1 10 1

ID: 3673851 • Letter: Y

Question

You are given the matrix equation Ax= b, where A= 10 1 0 0 0 1 10 1 0 0 0 1 10 1 0 0 0 1 10 1 0 0 0 1 10 b = 11 11 1 2 2 Enter the matrix, A, and vector, b, into a file or files in a format of your choosing. Then write a matalab program to perform the following steps: 1. Read the matrix and vector from the file. 2. Pass the matrix and vector to a function, then take the product of A and b to get a vector x. 3. Return to the main program and pass the vector x to another function for output. 4. Output the solution to a file.

Explanation / Answer

clear

mtx = readmtx(‘intext’,5,5,’int8’);

vec = readmtx(‘intext’,5,1,’int8’);

a = inverse(mtx);

function f = product(vec,a);

for ii = 1:5

b = fprintf(‘Ans:’,f(ii));

disp(b);

c = fopen(‘d:\outtext.txt’,w);

fprintf(c,’%f ’,b);

fclose(c);

end

end

product(vec,a)

x=vec *a;

y = sprint(‘%s,%f ’ ,x);

return y;

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote