1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matrices in MATLAB

  1. Jan 14, 2010 #1
    1. It's a matlab project. given a matrix of the type
    A (mod p)
    where p prime (and for now say the matrix is square, though i don't think this is that relevant) i need to write a program in Matlab that will calculate the basis of the kernel of the matrix. Obviously the null program wouldn't work.

    2. Relevant equations
    Prior to this I wrote the program that finds the row echelon form and the rank of any matrix of this form.

    3. The attempt at a solution

    What I'm trying to do is if i have a matrix of the form:

    [1 . . . .
    0 1 . . .
    0 0 0 1 .
    0 0 0 0 0
    0 0 0 0 0]

    or something along those lines.

    Take any such matrix A, and we want to find the basis for the space of all x such that Ax=0. So we can express:
    x4 in terms of x5
    x2 in terms of x3 and x5
    x1 in terms of x3 and x5
    That was basically the hint we got, so need to express the xi corresponding to the first elements in each row that has non-zero elements in terms of the other xj.

    I got this so far, though it's obviously incomplete

    [m,n] = size(A);


    x(r) = br(j)*x(j) (*)

    My first question is how to define an x s.t. this works? I would normally start with x=zeros(r,1), but it won't work with the code above. I would then define x(r) as in (*). Then x(r-1) and so on up til x=1. But i don't know what exactly to do.
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted