Highlighting the middle third of my data and plotting it_should be easy
1 view (last 30 days)
Show older comments
I want to identify a range of data (30-60%) and plot it. I can do the plotting ok but I seem unable to pull out the range I need. Instead of highlighting the middle third (approx) of the x values my code has highlighted under half.
My data is in variables named: normDisp - which I plot on x axis. Contains 8179 values from -0.1 to 6 approx. theLoad - which I plot on y axis. Contains 8179 values from -0.0026 to 1.2 approx.
Within these variables (and on the plot) I want to identify the sub-range of 30-60% within the larger range spanning between: index_normDisp_is_Zero (has value of 172) AND index_maxLoad (has a value of 1816)
plot(normDisp(index_normDisp_is_Zero:index_maxLoad+250),theLoad(index_normDisp_is_Zero:index_maxLoad+250))
hold on
plot(normDisp(index_maxLoad),theLoad(index_maxLoad),'rX')
hold on
rowsToPlot=round(0.3*(index_maxLoad-index_normDisp_is_Zero)):round(0.6*(index_maxLoad-index_normDisp_is_Zero))
plot(normDisp(rowsToPlot,1),theLoad(rowsToPlot,1),'rO')
0 Comments
Answers (2)
Walter Roberson
on 16 Jun 2011
rowsToPlot = index_normDisp_is_Zero + (round(0.3*(index_maxLoad-index_normDisp_is_Zero)):round(0.6*(index_maxLoad-index_normDisp_is_Zero)));
You calculated 0.3 and 0.6 of the distance from the start of the part of interest to the end of the part of interest, but you need to offset that by the start of the part of interest. For example, if the span of the section of interest was 10, you calculated 3 and 6 as your indices instead of calculating 3 and 6 in from the beginning of the section of interest.
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!