Help-Plot of two vectors - scatter plot with two subsamples??
Mostrar comentarios más antiguos
Hi all,
I have the following question:
I have two column vectors X (min value= -0.5; max value= 1.1; 1000 observations) Y (min value =-0.7; max value= 3; 1000 observations)
I would like to perform the following plot. Plot a subset of X (for -0.1 to 0.5) on the x-axis and the corresponding observations of Y on the y-axis.
I would like to split the Y observations in two groups around the point X=0, such that I have observations to the left of X=0 and to the right of X=0.I would also like to fit regression lines (lines of best fit) to the left and right of X=0 and compare their slopes. Can anybody help me with this difficult challenge?
Thanks for your time!
Respuesta aceptada
Más respuestas (1)
Jarek
el 13 de Mayo de 2012
0 votos
2 comentarios
Walter Roberson
el 13 de Mayo de 2012
in_subset = (X >= -0.1 & X <= 0.5);
X = X(in_subset);
Y = Y(in_subset);
Regression lines you should now be able to figure out for yourself using logical indexing.
Jarek
el 13 de Mayo de 2012
Categorías
Más información sobre Scatter Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!