MATLAB: How to find the values of 2 variables that will make the matrix rank 6

MATLABrank symbolic-matrix

I have the following symbolic matrix
M =
[ 4, -3, 0, 0, 0, 0, 0]
[ -2, 0, 1, 0, 0, 0, 0]
[ -6, 0, 0, 0, 12, 0, 0]
[ -3, 0, 0, 0, 0, 1, 0]
[ 0, 6, 0, -8, 0, 0, 0]
[ 0, 0, 0, 2, 0, 0, -4]
[ 0, 3, 0, 0, -y, 0, 0]
[ 0, 0, -5, x, 0, 0, 0]
I'd like to find any values of x and y that make M rank 6. How do I do this?

Best Answer

  • for x = -10:1:10
    for y = -10:1:10
    A = [ 4, -3, 0, 0, 0, 0, 0
    -2, 0, 1, 0, 0, 0, 0
    -6, 0, 0, 0, 12, 0, 0
    -3, 0, 0, 0, 0, 1, 0
    0, 6, 0, -8, 0, 0, 0
    0, 0, 0, 2, 0, 0, -4
    0, 3, 0, 0, -y, 0, 0
    0, 0, -5, x, 0, 0, 0] ;
    R = rank(A) ;
    if R == 6
    [x y]
    break
    end
    end
    end