Plotting a 2D matrix

I have some data I would like to visualize, only I'm not sure which is the way to go about it. I want to take a 42x72 matrix called "data" of integers and plot:
f(i,j,data(i,j)), where i and j are index's of the data matrix. And data is the name of the matrix which holds the data. Or we can use a and b since this is matlab and we have problems with complex #.
I essentially want a 3D plot or a color plot which could help me visulize where the highest values are in the "data" matrix.
In addition, I have the curve fitting tool box. I wanted to know if some kind of function could be generated to describe the values in the matrix. So: f(i,j) = data(i,j). Can I find a function in mathmatical terms, rather than just having a big matrix, "data", that stores my points.
Thank you

 Accepted Answer

doc surf
doc mesh
doc plot3
to name a few visualization tools. You CAN fit a function to it, will it be a good fit? Not necessarily - that depends on your data/system.

12 Comments

John
John on 23 Jun 2011
thank you could you point out what document to look up for curve fitting?
Open the curve fitting toolbox help and demos for how to use it. As for a GOOD fit - is there an analytical or empirical function that you data actually follows?
I would recommend reading John's reply nine here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294201
John
John on 23 Jun 2011
Thank you. And, the data was generated in an anaylitical fashion using descision statements. It does follow a trend. Is there anyway I could email you the data file??
Yes, but I may not look at it until tomorrow seeing as how it's almost five - happy hour :)
type
sftool
at the command line then use your data and analytical function.
John
John on 23 Jun 2011
It is definintaly non-linear. When I said analytical I mean it more from the method in how the data was generated. It's not random, but there is no analytical function.
Then why do you want to fit an analytical function to it? What would you gain from having an analytical function (such as one generated by the SFT or a least squares fit)?
John
John on 23 Jun 2011
I wanted to see if I could fit the data to a polynomial. 5th order which max for me is not big enough
John
John on 23 Jun 2011
Thanks for the help
You might as well fit (42*72)th order polynomial to it so it runs through every point! They'll both be wrong and for any real purpose, useless.
Other than seeing if you could fit a polynomial to it, why do you want to? What is your end goal I guess?
John
John on 23 Jun 2011
I am working in a memory limited enviroment<1KB. So having a large matrix or array that stored data points was not practical. I wanted to know if it was possible to generate the data on demand from a mathmatical function. This way I wouldn't have to store ever piece of data in an array.
John
John on 23 Jun 2011
The data represents probablity on a 2D map. So if I could generate the probablity just based on an equation, it would save memory.
< 1Kb! Is there any option of getting more memory? If you just need to be able to generate points in this _exact_ space you could use a higher order polynomial. But it would be unstable for ANY other application.
Overall, I'd recommend getting more memory...

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!