How to make one 53228x1 double matrix a function of another 53228x1 double matrix?
Mostra commenti meno recenti
I have two matrixes, GalList.mass and GalList.dist, that I need to create a singular function out of.
Both have dimensions of a 53228x1 double matrix.
GalList.mass is essentially a collective matrix of masses in the universe, while GalList.dist is a collective matrix of the distances of galaxies in the universe. I need to make a mass a function of distance, or M(r), but I do not know how to do that. I have tried nested functions, but that did not help.
SIDE NOTE: X1 = GalList.dist Y1= GalList.mass
I am fairly new to Matlab, so any help would be appreciated!
Risposta accettata
Più risposte (2)
Image Analyst
il 8 Mar 2015
0 voti
What kind of function do you expect? Is there a relationship? Did you try scatter(X1, Y1) to check?
4 Commenti
jgillis16
il 8 Mar 2015
John D'Errico
il 8 Mar 2015
If there is NO relationship, then there is no function. Are you asking to find a functional form that relates the two set of numbers?
Image Analyst
il 8 Mar 2015
I don't see any reason why the mass would change with distance from us unless we held some special place in the universe, like at the center where the big bang was. If you think you see more spread as distance gets higher, I think that's just because there are more data points out there. Of course there will be more galaxies between 20 and 25 mpc than between 0 and 5 mpc because it covers more actual volume so you will have more data points out there that you will see when you plot them. If you were able to have more data points in close, then you might see a similar spread. Just because data points are missing does not mean the probability distribution function would be different. For a given distance, if the probability of some mass is an inverse/decreasing function, it will probably be that same function no matter where in space you're looking - close to us or far away from us, unless like I said we have a special place like at the center or edge of the universe. Is there any theory that says that galaxies closer to us tend to be smaller than galaxies farther away? If you chopped up the universe into a cube of say, 10 by 10 by 10 array of boxes, do you think that the mean galaxy size in the cubes varies by more than randomness would suggest, and varies in a deterministic way that depends on how far the cube is away from the cube where our Milky Way lies? I could see that possibly the galaxy mass mean might vary from how far it is from the center of the universe (like big chunks from the big bang ended up closer or farther away from the epicenter), but from our galaxy? I just don't see a reason. But I could be wrong - I'm not an astrophysicist.
John D'Errico
il 8 Mar 2015
I do agree with the point that Image makes, that unless we are special, then no relationship can hold.
However, there MAY easily be a censoring bias. That is, if we can't see the low mass objects that lie far away, then they won't appear in the data set, so there might be a false relationship inferred. In fact, you would need to show that such a censoring problem was NOT happening were you to try to convince me that you had found something of any significance.
John D'Errico
il 8 Mar 2015
Modificato: John D'Errico
il 8 Mar 2015
This is NOT what nested functions are for. :) In fact, your question was not at all about functions in a MATLAB context.
It seems that you have two variables, distance and mass. You wish to postulate that they follow a cubic relationship. I'll assume that you are saying that galaxy(1) has measured mass(1) and distance(1), and so on for each of the 53228 objects in this sample. If those two vectors do NOT follow that relationship, then you can do absolutely nothing here.
But if we wish to show that mass is proportional to the cube of distance, then just plot them, using a log-log scale. That is, if we had
mass = k*distance^3
then
log(mass) = log(k) + 3*log(distance)
So IF that plot follows a straight line, (yeah, a noisy straight line, but a straight one) with a slope of 3, then you have essentially shown that power law to be a viable model.
IF there is curvature in that plot, then you could not make such a claim. So I would use a modeling tool to estimate a simple polynomial model (say quadratic or at most cubic) in the log-log domain. If the higher order power(s) of distance have a statistically significant coefficient, then you would need to reconsider your model. Likewise, if the coefficient of distance is itself statistically different from 3, then again, your model fails to hold up.
Finally, because of the rather noisy data, with clear outliers, you will need to use a tool that can handle robust fitting. I'd start with robustfit from the stats toolbox.
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!