Thread: Matrices

  1. #1
    Unregistered
    Guest

    Matrices

    Any ideas on how to deal with reading in matrices and manipulating them?

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Sorry, you need to be more specific.

  3. #3
    Unregistered
    Guest
    ok here's some more info:

    I am currently studying the size and shape of the beam produced by my school's electron accelerator. To do this i have basically put a piece of cobalt infront of the beam so that the shape would be burnt into the piece of cobalt.

    I used a vb program to run my scanning device and create a matrix of the counts(pulses of xrays given off by the irradiated cobalt)

    After that i used Mathcad to create a surface plot of the counts which gave me a perfect picture, but it was flipped upside down and backwards.

    What i would like to do is take that matrix of numbers and read it into c++, flip the matrix around until the matrix is such that when i put it into mathcad it will give me a perfect plot.

    My problem lies in that i have not taken enough c++ courses to know how to deal with matrices and the sites on the web that i have found on the web are too confusing for me.

  4. #4
    Unregistered
    Guest
    i guess i would want to do something similar to insertion sort/selection sort etc... However as i understand vectors, it's sort of just a long line of numbers. I will need to move things up and down as well as left and right in my matrix.

    hope this clarifies my situtation better

  5. #5
    Registered User Mario's Avatar
    Join Date
    May 2002
    Posts
    317
    hmm... I can't seem to remember vectors that well anymore.
    But I have this feeling all you have to do is to multiply them by -1 for the graph to plot correctly.

    Other than that, you can easily swap positions on a matrix under VB... what are you using as a matrix? a multi-dimensional array?

    [EDIT] by vectors, I mean the mathematical vector... not the C++ vector. I believe that's what your matrix is being translated to in mathcad? right?[/EDIT]
    Regards,
    Mario Figueiredo
    Using Borland C++ Builder 5

    Read the Tao of Programming
    This advise was brought to you by the Comitee for a Service Packless World

  6. #6
    Unregistered
    Guest

    Unhappy

    i've thought about that, the only problem is i didn't write the vb code and i am not familiar with vb... only c++

  7. #7
    Unregistered
    Guest

    Unhappy

    yes it's being converted into a mathematical vector in mathcad.

    As for multplying by -1... i wish it were that simple. The vector needs to be flipped along it's vertical axis and the horizontal axis and then rotated 90 degrees inorder for the picture to come out the righ way

  8. #8
    Registered User Mario's Avatar
    Join Date
    May 2002
    Posts
    317
    I believe this could still be done in mathcad without the need to use yet a 3rd program to finally plot the correct graph. Those rotations and flippings are in fact "simple" math operations on vectors (I take it they lie on a 2D plane)... although I'm afraid I can't remember how to anymore.

    No matter what, under C++, you will surely be way more comfortable swapping the matrix elements by using c++ vectors.

    I did a quick search on google and it came out with a bunch of vector tutorials. Search with "c++ vector tutorial". (without the quotes)

    You may also want to refresh your memory on the fstream for file input and output. Same stuff... "c++ fstream file i/o tutorial"

    As soon as you get it done to minimal code, I'm sure many here will be glad to help you finish it.
    Regards,
    Mario Figueiredo
    Using Borland C++ Builder 5

    Read the Tao of Programming
    This advise was brought to you by the Comitee for a Service Packless World

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C simple Matrices
    By Cyberman86 in forum C Programming
    Replies: 3
    Last Post: 05-07-2009, 05:20 PM
  2. Help getting started..matrices
    By BobDole11 in forum C Programming
    Replies: 7
    Last Post: 11-15-2008, 09:51 PM
  3. adding matrices, help with switches
    By quiet_forever in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2007, 08:21 AM
  4. Comparing Matrices (D3D9)
    By MicroFiend in forum Game Programming
    Replies: 2
    Last Post: 10-12-2005, 08:36 AM
  5. Problem multiplying rotation matrices together
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 03-04-2003, 09:20 AM