Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This is not really my field so please bear with me. In the equation:

$ (X^TX)\hat{h}_q = X^Ty_q $

I need to find the vector $\hat{h}_q$. $X$ and $y_q$ are known, and $y_q$ is the same length as $\hat{h}_q$.

$X$ is a matrix of the form:

$$X = \begin{pmatrix} 1 & 0 & 0 &0 \\ 2&1&0&0\\3&2&1&0\\4&3&2&1\\0&4&3&2\\0&0&4&3\\0&0&0&4\end{pmatrix}$$

but instead of 1 - 4 it's a vector of random numbers about 3500 long.

share|improve this question
    
This is not what I would call a diagonal matrix. –  Gerry Myerson Mar 12 '13 at 0:05
add comment

1 Answer

up vote 0 down vote accepted

$h_q = (X^TX)^{-1}X^Ty_q$. Use matlab or octave to find $X^TX$ and its inverse.

share|improve this answer
    
Thank you, this is helpful, but it's causing some unhappyness with Matlab. If $X$ is a 100 row by 50 col matrix, then $(X^TX)^{-1}X^T$ is a 50 row by 100 col matrix, correct? If y is then a 200-element column vector, I cannot multiply them together it seems? (at least, matlab says dimensions do not agree). –  Jordan Mar 12 '13 at 0:34
    
Your question has $X^Ty_q$ in it. If $X$ is $100\times50$ and $y_q$ is $200\times1$ then your question makes no sense. –  Gerry Myerson Mar 12 '13 at 12:37
    
@GerryMyerson Yes, I realized I have to modify $X$ depending on the length of $y_q$. Sorry for the confusion there. I have now hit a second problem though: my $X$ is 7000x10000, and trying to find the inverse of that is crashing Matlab on even the most powerful computer in our lab. Is there any way to do it in a way that won't cause that problem? –  Jordan Mar 12 '13 at 23:11
    
First, that's a new question, not a comment on an answer to an existing question. Second, it may be a question better suited for the programming site than this math site. –  Gerry Myerson Mar 12 '13 at 23:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.