Any ideas on how to deal with reading in matrices and manipulating them?
Printable View
Any ideas on how to deal with reading in matrices and manipulating them?
Sorry, you need to be more specific.
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.
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
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]
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++
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
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.