Healing Tao USA Medical and Spiritual Qigong (Chi Kung) Logo
Healing Tao USA
  • 501 c3 non-profit 

  • All purchases tax deductible
  • Home
    • Primordial Tai Chi for Enlightened Love
    • Our Mission
  • Workshops
    • Current Teaching Schedule
    • Become a Certified Instructor
  • Products
    • Guide to Best Buy Packages
      • Qigong (Chi Kung) Fundamentals 1 & 2
      • Qigong (Chi Kung) Fundamentals 3 & 4
      • Fusion of the Five Elements 1, 2, & 3: Emotional & Psychic Alchemy
      • Inner Sexual Alchemy
    • Best Buy Packages Download
    • Video Downloads
    • Audio Downloads
    • DVDs
    • Audio CD Home Study Courses
    • eBooks & Print Books
    • Super Qi Foods & Elixirs
    • Sexual Qigong & Jade Eggs
    • Medical Qigong
    • Chinese Astrology
    • Other Cool Tao Products
      • Tao T-Shirts
      • Joyce Gayheart
        CD’s and Elixirs
      • Qi Weightlifting Equipment
  • Summer Retreats
  • Articles / Blog
    • Loving Tao of Now
      (Michael’s blog)
    • 9 Stages of Alchemy
    • Tao Articles
    • Newsletter Archive
  • FAQ / Forum
    • FAQ
    • Forum Online Discussion
    • Loving Tao of Now
      (Michael’s blog)
  • Winn Bio
    • Short Bio
    • Michael Winn: The Long Story
    • Tao logo: Musical Cosmology
  • China Trip
    • China Dream Trip
    • Photos: Past China Trips
  • Contact
    • Office Manager – Buy Products
    • Summer Retreats – Register
    • Find Instructor Near You
    • Links
    • Site Map
  • Cart

discrete fourier transform in 2D

By

Home › Forum Online Discussion › General › discrete fourier transform in 2D

  • This topic has 9 replies, 1 voice, and was last updated 17 years ago by Swedich Dragon.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • September 8, 2008 at 3:00 pm #29074

    Swedich Dragon

    Hello

    Propably completely wrong forum.

    I do FFT on a two dimensional matrix. Matlab gives complex coefficients. I have written a program that calculate the sine and cosine coefficients.

    When calculating the original discrete funnction from this coefficients I’ve got the right answer but:

    On a 4×4 matrix the column 2 and four are shiftet with eachother. Strange. Otherwise I’ve got the right answer.

    Perhaps check for other matrix dimensions also.

    Hm.

    I had no formula for the calculation of the coefficients, so I have made my own. That might be the problem.

    S D

    September 8, 2008 at 3:10 pm #29075

    Swedich Dragon

    %Of course you can do two dimensional fft with fft2, but the problem is that I need
    %the real coefficients and not know how to convert them.

    clear
    format short
    %This is the matrix to do fft on
    tal=[13 3 55 42
    3 5 7 9
    4 2 6 88
    2 4 6 7]

    %This is the make the complex coefficients
    koff=fft(tal’);

    %I want later to do the fourier transform on a and b real cofficients, they will be %aranged so that I do the FFT on the coefficients with the same frequency
    koff=koff’;

    %formulas for calculating the real from the complex
    konjkoff=conj(koff);
    ak=koff+konjkoff;
    bk=i*(koff-konjkoff);

    %found out that the discrete real coefficients should be half of what the
    %continuous was, when calculating them from the complex
    ak=ak/2;
    bk=bk/2;

    %1D fourier transform over each column with real coefficients of the same frequenscy
    koffa=fft(ak);
    koffb=fft(bk);
    konjkoffa=conj(koffa);
    konjkoffb=conj(koffb);

    %for the one start with an a
    aa=(koffa+konjkoffa)/2;
    ab=(i*(koffa-konjkoffa))/2;

    %for the one start with an b
    ba=(koffb+konjkoffb)/2;
    bb=(i*(koffb-konjkoffb))/2;

    %summa=zeros(4,4);
    %n and m are the place in the matrix for reconstructing tal from the real
    %coefficinets
    for n=1:4
    for m=1:4

    %m=1
    %n=3
    summa=0;
    %k and p are the different frequencies
    for k=1:4
    for p=1:4
    summa=summa+aa(p,k)*cos((2*pi*(k-1)*(n-1))/4)*cos((2*pi*(p-1)*(m-1))/4)…
    +ab(p,k)*cos((2*pi*(k-1)*(n-1))/4)*sin((2*pi*(p-1)*(m-1))/4)…
    +ba(p,k)*sin((2*pi*(k-1)*(n-1))/4)*cos((2*pi*(p-1)*(m-1))/4)…
    +bb(p,k)*sin((2*pi*(k-1)*(n-1))/4)*sin((2*pi*(p-1)*(m-1))/4);

    end
    end

    svar(m,n)=summa/16;

    end
    end
    svar

    September 8, 2008 at 3:11 pm #29077

    Swedich Dragon

    Besy should be the formulas for convertion but I haven´t found them.

    September 8, 2008 at 3:29 pm #29079

    Swedich Dragon

    Hello

    The matrix is just for me to see if I did it right, the real matrixes in my project are huge!

    S D

    September 8, 2008 at 3:31 pm #29081

    Swedich Dragon

    Hello

    Is that a more reliable program than matlab?

    S D

    September 8, 2008 at 3:37 pm #29083

    Swedich Dragon

    Hello

    Perhaps I do not need the FFT. But I need the real coefficients from discrete fourier transform in 2D anyway!

    S D

    September 8, 2008 at 4:24 pm #29085

    Swedich Dragon

    I was out walking to buy some milk for tomorrow. Found two ideas. One was to change the m-1 or the n-1 to m respectively n. Beacase the answer was wery close but had the following look.

    Firs column right. column two=equal to the last and the rest was in reversed order.

    SO

    the picture was

    1 5 4 3 2 if 5×5 matrix

    1 4 3 2 if 4×4

    So i realised that I was close to the solution.

    I got the idea to change the rows with the columns in the fft, had tried it before but now I did want to do it on two places at the same time. this wery intuitive idea turned out the be rigth. Have not realised why jet. That is the work for tommorrow.

    Today I travelled in to the university and looked for books on this at several places, but couldn´t find any. So during the luch brake I got the basic idea in my head. sketched it on the bus and programmed it this evening. Found the error made beacase I didn´t have the full theory just new that 2d discrtet could be done in two steps first as a a 1d at each row and then a new to the result.

    I´m happy to have solved it, but without any rigourous theory, bad.

    S D

    The changes are marked with many !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    clear
    format short
    %This is the matrix to do fft on
    tal=[13 3 55 42
    3 5 7 9
    4 2 6 88
    2 4 6 7]

    %This is the make the complex coefficients
    koff=fft(tal’);

    %I want later to do the fourier transform on a and b real cofficients, they will be %aranged so that I do the FFT on the coefficients with the same frequency
    koff=koff; TAKEEN AWAY THE TRANSPOSE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ACTION ONE OF TWO

    %formulas for calculating the real from the complex
    konjkoff=conj(koff);
    ak=koff+konjkoff;
    bk=i*(koff-konjkoff);

    %found out that the discrete real coefficients should be half of what the
    %continuous was, when calculating them from the complex
    ak=ak/2;
    bk=bk/2;

    %1D fourier transform over each column with real coefficients of the same frequenscy
    koffa=fft(ak’);!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!I put in the transpose here. The difference is that now the fft is ower different frequencies. I think. havent analysed it jet.

    koffb=fft(bk’);
    konjkoffa=conj(koffa);
    konjkoffb=conj(koffb);

    %for the one start with an a
    aa=(koffa+konjkoffa)/2;
    ab=(i*(koffa-konjkoffa))/2;

    %for the one start with an b
    ba=(koffb+konjkoffb)/2;
    bb=(i*(koffb-konjkoffb))/2;

    %summa=zeros(4,4);
    %n and m are the place in the matrix for reconstructing tal from the real
    %coefficinets
    for n=1:4
    for m=1:4

    %m=1
    %n=3
    summa=0;
    %k and p are the different frequencies
    for k=1:4
    for p=1:4
    summa=summa+aa(p,k)*cos((2*pi*(k-1)*(n-1))/4)*cos((2*pi*(p-1)*(m-1))/4)…
    +ab(p,k)*cos((2*pi*(k-1)*(n-1))/4)*sin((2*pi*(p-1)*(m-1))/4)…
    +ba(p,k)*sin((2*pi*(k-1)*(n-1))/4)*cos((2*pi*(p-1)*(m-1))/4)…
    +bb(p,k)*sin((2*pi*(k-1)*(n-1))/4)*sin((2*pi*(p-1)*(m-1))/4);

    end
    end

    svar(m,n)=summa/16;

    end
    end
    svar

    September 8, 2008 at 4:27 pm #29087

    Swedich Dragon

    Hello

    I´m glad that you have showed me the program, but I don´t think I want to change it for this work.

    The reason is that I know matlab quite alright. Another reason is that I have dyslexia, (perhaps it is another name in english, when you have dificulties with spelling reading and such things. For me it is spelling and to remember new words that is my dyslexia)

    And with this in mind there is quite huge problems involved with changing programming languages.

    Thanks anyway, perhaps for the future.

    S D

    September 9, 2008 at 9:49 am #29089

    Swedich Dragon

    Hello

    The error was actually that the transpose with a complex matrix is another thing than the transpose of a real one.

    And the second fourier transform work over equal frequencies.

    S D

    September 9, 2008 at 9:49 am #29091

    Swedich Dragon

    Hello

    The error was actually that the transpose with a complex matrix is another thing than the transpose of a real one.

    And the second fourier transform work over equal frequencies.

    S D

  • Author
    Posts

You must be logged in to reply to this topic.

Signup for FREE eBook – $20 value

Inner Smile free eBook with Signup to Newsletter

Way of the Inner Smile
130 page eBook

+ Qi Flows Naturally news

+ Loving the Tao of Now blog

Enter Email Only - Privacy Protected

Forum Login

Log In
Register Lost Password

Qigong Benefits – Michael Winn

Michael Winn Qi Products:

Best Buy Packages
  1. Qigong Fundamentals 1 & 2
  2. Qigong Fundamentals 3 & 4
  3. Fusion of Five Elements 1, 2, 3
  4. Sexual Energy Cultivation
  5. Primordial Tai Chi / Primordial Qigong
  6. Inner Sexual Alchemy Kan & Li
  7. Sun-Moon Alchemy Kan & Li
  8. Inner Smile Gift
Individual Products
  1. Qigong Fundamentals 1
  2. Qigong Fundamentals 2
  3. Qigong Fundamentals 3
  4. Qigong Fundamentals 4
  5. Fusion of Five Elements 1
  6. Fusion of Five Elements 2 & 3
  7. Sexual Energy Cultivation
  8. Tao Dream Practice
  9. Primordial Tai Chi / Primordial Qigong
  10. Deep Healing Qigong
  11. Internal Alchemy (Kan & Li Series)

100% RISK FREE 1-Year Guarantee

Michael Winn, President, Healing Tao USA Michael Winn, President, Healing Tao USA

Michael Winn, Pres.
Healing Tao USA

Use Michael Winn's Qi Gong products for one whole year — I guarantee you'll be 100% delighted and satisfied with the great Qi results. Return my product in good condition for immediate refund.

Guarantee Details

Your Natural Path is Our Mission

OUR PROMISE: Every Michael Winn Qi gong & meditation product will empower you to be more relaxed, smiling, joyful, and flowing in harmony with the Life Force.

yin-yang

Each Qigong video, book, or audio course will assist your authentic Self to fulfill worldly needs and relations; feel the profound sexual pleasure of being a radiant, healthy body; express your unique virtues; complete your soul destiny; realize peace – experience eternal life flowing in this human body Now.

Inner Smile free eBook China Dream Trip Spiritual Adventure Summer Retreats in the NC Mountains Workshop with Michael Winn Tai Chi & Qugong DVDs

Copyright © 2025 Healing Tao USA · site by expansive web design · design by dragonbutterfly design · info@michaelwinnv5.qlogictechnologies.com · Log in