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

A, which we will call here a In this exercise, you will create, when possible, a

ID: 3879051 • Letter: A

Question

A, which we will call here a In this exercise, you will create, when possible, an m by n matrix Generalized Hilbert matrix, such that its (i, j)Hentry, A(ij), is calculated by means of the formula A(ij)-i +j-1), where i runs from 1 to m and j runs from I to n. To decide whether A can be created, you will first check in your code if the variables m and n are integers. You can use a conditional "if" statement (see for help http://www.mathworks.com/help/matlab/refif html) and a MATLAB built-in function such as mod, fleor, or fix 1) If either m or n is not integer, the outputs have to be an empty matrix (assign A-I D and the message "Error: both m and n must be integers" and then the program terminates (the command "return" will terminate it). 2) If both m and n are integers, proceed to calculation of the entrics of A as (1) AGj)-1(i+j-1) when m t n (by using double for loop), and (2) employ a MATLAB built-in function A - hilb(m) when m-n. In the case when m - n, also compute the inverse of 6 A, a matrix B- invhilb(m). To output B, do not put semicolon after the command B- invhilb(m). Also, use format rat in your code to output the matrix A with rational entries when A is not empty "Create the function genhilb in MATLAB using the Instructions above: A genhilb (m, n) Call your diary file Project0 in the Command Window (see Exercise 1 in this project). Type the function in your diary file using the command Run the function type genhilb A-genhilb(m, n) on each of the following sets of variables:

Explanation / Answer

function A = genhilb(m,n);
  
format rat;
if(m==floor(m) && n==floor(n))
if(m~=n)
for(i=1:m)
for(j=1:n)
A(i,j) = 1/(i+j-1);
end
end
disp("A : ");
disp(A);
  
else
A = hilb(m)
B = invhilb(m)
end
else
A = [];
disp("Error: both m and n must be integers");
return;
end

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