Plot regression with time

Dear all,
Sorry for the novice question, I have a dependent variable (y) and an independent variable (x). Just to show how these two variables relate to each other I can use plotregression function, however each observation belongs to a different time point and i need to have time factor in my plot to show how the change of these two variables could be related to time. Which plot would you recommend in MATLAB? I would prefer the most visually appealing as my aim is to present my data.
Thanks in advance

 Risposta accettata

Image Analyst
Image Analyst il 1 Lug 2012

1 voto

A common way to show 2D data is via images. You could have time along one axis, your independent variable x along the other axis, and your dependent variable y as the image intensity. If you don't have all x for all t, then you could fill out the 2D matrix for the missing x,time pairs with TriScatteredInterp(). If the image is nice and smooth, then you might also look to display it with surf() instead of imshow() or image().

5 Commenti

Arman
Arman il 1 Lug 2012
Modificato: Arman il 1 Lug 2012
Brilliant. Suppose:
t is a vector of time (5 time points) and n is the number of observations
x is n-by-t matrix
y is n-by-t matrix How could I go for image() then? It seems that I could have 2 inputs in this function? right? How about surf()?
Image Analyst
Image Analyst il 1 Lug 2012
I thought that x and y would be 1D arrays. So that for a given time point, you had exactly one x parameter that you set (since it's independent variable), and one y parameter that you observed (since it's the dependent variable). But now you're saying that x is n by t so that for a given t, you're going to have n x settings, and n y observations. Is that correct? So do you have n experiments running where each experiment gets run at the same time and each experiment has an x,y pair? I need to figure out what's going on.
Arman
Arman il 1 Lug 2012
Modificato: Walter Roberson il 1 Lug 2012
But now you're saying that x is n by t so that for a given t, you're
going to have n x settings, and n y observations. Is that correct?
Thats correct.
So do you have n experiments running where each experiment gets run at the same time and each experiment has an x,y pair?
That's completely correct. To make it a real world example, there are n subjects each assessed in t time-points, each time point has 2 scores one dependent and one considered to be independent variable (x,y pairs as you reckoned).
Image Analyst
Image Analyst il 1 Lug 2012
Can you just stitch together the 5 images side by side? Or else make a movie (animated gif) where it plays the different time point images over and over?
Arman
Arman il 1 Lug 2012
Probably the first option as it is going to be presented on paper.

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by