plot - How can I get good Y axis intervals when plotting in Matlab? -
i'm trying plot vector (with dynamically changing size / values) have 50-150 elements, values ranging 0.3331 1.7378 (random example).
is there way plot a) values on y axis presented 2 decimal places. b) y axis starts minimum value rounded down closest 0.5, c) y axis ends @ maximum value rounded closest 0.5 , d) there 10 intervals.
so example of 0.3331 minimum , 1.7378 maximum, y axis start @ 0 , finish @ 2.
this attempt @ setting intervals:
ymin = floor(minvalue) ymax = ceil(maxvalue) yint = ymin:(ymax-ymin)/10:ymax i'm quite newbie programming in general , doesn't work want to. have tried lot of things , can't seem right. able provide me solution this? extremely grateful.
you can round up to or down to value using code
minvallimit = floor(minval/roudingvalue)*roundingvalue maxvallimit = ceil(maxval/roudingvalue)*roundingvalue so e.g.
0 = floor(0.3331/0.5)*0.5 2 = ceil(1.7378/0.5)*0.5 next topic: rounding 2 decimal places
roundedvalue = round(myval*100)/100
Comments
Post a Comment