[MATLAB] Gram-Schmidt routine thoroughly explained


In Digital Signal Processing (DSP) one should often work or encounter the notion of vector and function spaces and finally orthonormal basis. The latter is one of those small building blocks which makes so many devices working and kicking.

The goal of this article is to publish MATLAB source code of the Gram-Schmidt algorithm. Given a set of linearly independent vectors, the algorithm returns a set of orthonormal basis. It is said that this basis spans the vector space. In other words, any vector from this vector space can be uniquely expressed using those basis vectors.

This algorithm enforces the so-called orthogonality principle. This principle is one of corner stones of the modern DSP.  It’s role can be hardly overestimated. For example, without it FFT wouldn’t work! And without FFT… we would be somewhere in the ages before 19th century…

The shared algorithm is the classic one. A word of caution here – the classic algorithm is numerically unstable. One should implement the modified version, which requires only a small modification.

The source code can be downloaded [HERE]. I tried to comment it heavily so that it is maximally clear what is happening at each step.

In applications where the input matrix is large and requires numeric stability, and speed, one should instead use the optimized QR decomposition routines [wiki]. The QR decomposition returns the Q matrix (exactly a matrix of orthonormal basis as for the Gram-Schmid algorithm) + an upper triangular matrix with dot products (basis i with input vector j)…

Let me share a small gem. Suppose you are give 4 out of 5 orthonormal vectors that span 5 dimensional vector space. You would like to find the 5th missing orthonormal vector. With this routine you can find it easily the following way:

  1. Initialize the input matrix with zeros
  2. Put in the first 4 columns the orthonormal vectors you have
  3. In the last column put just random values
  4. Run the routine

In the output you should get a matrix with the first 4 columns identical to those 4 given orthonormal vectors, while the last 5th column will be the missing orthonormal vector – the one you were looking for. Actually you can have several missing orthonormal vectors and the algorithm will still work.


Vladd... call me Vladd
This entry was posted in Uncategorized and tagged , , , , , , , , , . Bookmark the permalink.

29 Responses to [MATLAB] Gram-Schmidt routine thoroughly explained

  1. 76Emerson says:

    Hello admin, i must say you have very interesting articles here.

    Your page can go viral. You need initial traffic boost only.
    How to get it? Search for; Mertiso’s tips go viral

  2. LastDorthea says:

    I see you don’t monetize your page, don’t waste your traffic, you can earn additional bucks every month because you’ve got high quality content.
    If you want to know how to make extra $$$, search for: Mertiso’s tips best adsense

  3. BestJohanna says:

    I have noticed you don’t monetize your site, don’t waste your traffic,
    you can earn additional cash every month because you’ve got hi quality content.
    If you want to know how to make extra bucks, search for:
    Ercannou’s essential adsense alternative

  4. Excellent blog right here! Also your web site
    a lot up very fast! What host are you using?

    Can I am getting your affiliate link for your host?
    I wish my site loaded up as quickly as yours lol

  5. masallar says:

    Masal OKU çocuk masallari kisa masallar

  6. masal oku says:

    masal oku güzel masallar oku masal okumanin adresi gönlünüzün rahatligiyla bu siteden masal okuyabilirsiniz

  7. masal says:

    masalda en güzel sözler

  8. Hi Bro, Thank you very much for your writing and your article and I wish you continued success. Please try to produce such valuable content in the following processes. In addition to this article, I am very happy to see your unique content.

  9. Hi Bro, Thank you very much for your writing and your article and I wish you continued success. Please try to produce such valuable content in the following processes. In addition to this article, I am very happy to see your unique content.

  10. Dog Beds says:

    Thanks , I have recently been searching for information about this subject for a long time and yours is the greatest I’ve came upon till now. But, what concerning the conclusion? Are you positive about the source?

  11. Software cracking is the modification of software to remove or disable features which are … It might be legal to use cracked software in certain circumstances.

  12. Bobbie Kekua says:

    Hi there?If you are into facebook ads and bing ads,ad are short on cash
    for your ads campaign,i will show you a method where you will get $100
    facebook ads credit and $500 Bing ads credit.I will put this out there
    for a limited time and take it down soon as the limit is reached.
    Hurry now!
    Check it now HERE

  13. thank you for sharing. Come back our website.

  14. Wow! Thank you! I continuously needed to write on my website
    something like that. Can I implement a fragment of your post to my

  15. An outstanding share! I’ve just forwarded this onto a co-worker who had
    been conducting a little research on this. And he in fact ordered me lunch due to the fact that I discovered it for him…
    lol. So let me reword this…. Thanks for the meal!!
    But yeah, thanks for spending the time to discuss this matter
    here on your web site.

  16. Hans says:

    Hi there, just became aware of your blog through Google, and found that it is truly informative.
    I am gonna watch out for brussels. I’ll be grateful if you
    continue this in future. A lot of people will be benefited from your writing.

  17. child says:

    ankara porno

  18. I am continuously looking online for posts that can aid me. Thx!

  19. Carey says:

    Howdy fantastic website! Does running a blog like this require a great
    deal of work? I have virtually no understanding of coding however I
    was hoping to start my own blog soon. Anyway, should you
    have any recommendations or tips for new blog owners please share.
    I know this is off subject however I simply wanted to ask.

  20. This post was amazing i actually read your blog very often, and you’re consistently comijg out with some great stuff.
    I contributed this on my blog, and my followers adored it.
    I really admire the good work 🙂

  21. Hiciste algunos puntos decentes allí. He comprobado een Internet
    pafa obtenr más información sobre el tema y encontré
    la mayoría dde las personas aceptará sus opiniones en este sitio .

    estaré agradecido cuando continúe esto en futuro.
    Numerosos personas
    Hola , creo que noté que visitawste mi
    sitio web así que llegué para regresar
    el querer ?. Estoy intentando en encontrar información. Suerte conmigo Encontré su siti
    por casualidad (tropiezo). He marcado como libro parra más tarde |
    Es enorme que estás obteniendo ideas de este párrafo así como
    de nuestro debate hecho en este lugar .|
    Si desea aumentar su conoocimiento solo siga visitando este sitio web y se actualizará con el más nuevo actualización dee noticias publicado aquí.

    Lo que está bajando soy nuevo en esto, me topé con esto
    he encontrado absolutamente útil y me ha ayudqdo mucho.
    Espero contribuir y asistencia diferente usuarios como ayudó a mí.
    Gran trabajo. |
    Hurray, eso es lo que estaba buscando , ¡qué material!
    presente aquí en este página web , gracias administrador dee este página web.
    Hola, sé que esto está fuera dee tema, pero me
    preguntaba si sabías de algún widget que puduera agregar a mi blog que tuitee automáticamente
    mis últimas actualizaciones de Twitter. He estado buscando un complemento como este durante
    bastante tiempo y esperaba que tal vez tuvieras alguna experiencia con algo como
    esto. Avísame si te encuentras con algo. Relmente disfruyto leyendoo tu blog y
    espero tus nuevas actualizaciones.

  22. What’s Happening i’m new to this, I stumbled upon this I have discovered It absolutely helpful and it has aided me out loads.

    I’m hoping to contribute & aid different customers like its aided me.
    Great job.

  23. I really liked this post i read your blog fairly often, and you’re constantly
    coming out with a lot of great stuff. I embedded this on my blog, and my followers adored it.
    I really admire the very good work 🙂

  24. It’s nearly imposѕible to find experienced people on this topic, however, you seem like you know what you’re talking about!

  25. Le coq chante à midi, signe d’un temps de paradis http://www.sansordonnanceviagra.fr#achat

  26. ecra.se says:

    Asking questions are in fact good thing if you are not understanding something fully,
    but this paragraph offers good understanding even.

  27. Saangat bermanfaat sekali gan. Kayanya agus buat di coba nih ilmunya.
    Bukan hanya sya saja yang merasakan manfaatnya loh, tetapi buat orag lain juga.

  28. Mencari artikel yang bermanfaat itu memang sulut gan.
    Tapi setelah saha membaca aartikel ini banyak sekali manfaat yang saya dapatkan.

Leave a Reply

Your email address will not be published. Required fields are marked *