Create a function csolve2.m with input matrix A and a column vector b and no out
ID: 3860837 • Letter: C
Question
Create a function csolve2.m with input matrix A and a column vector b and no output. The function should display the rank, the pivot and free variables of A, the particular solution to Ax = b, and the special solutions for A. Test it using the system below. A = [1 -8 -7 5 0 0 -3 2 1 -8 -10 7], b = [4 -3 1], Your display should be precisely the following: >> csolve2(A, b) The rank of the coefficient matrix is 2. Pivot variables: 1 3 Free variables: 2 4 The particular solution is: xp = 11.0000 0 1.0000 0 The special solutions are: xs = 8.0000 -0.3333 1.0000 0 0 0.6667 0 1.0000Explanation / Answer
% I'm doing 80% of given problem... I am unable to find exact and special solutions... Bt instead i am giving total solution of Ax = b
function csolve2(A,b)
disp(sprintf("The rank of the coefficient matrix is %d",rank(A)));
[B, pivot] = rref(A);
fprintf("Pivot variables: %s ",sprintf("%d ",pivot))
fprintf("Free variables: %s ",sprintf("%d ",setdiff(1:size(A,2),pivot)))
disp("Total solution is :")
C = A;
disp(C)
end
csolve2([1 -8 -7 5; 0 0 -3 2; 1 -8 -10 7],[1 ; 3 ; 5])
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.