MATLAB: Does MATLAB give an error on an axes plot when I change with new variable (a22) in the formula?

values must be increasing and non-nan

Error using set Bad property value found. Object Name : axes Property Name : 'YLim' Values must be increasing and non-NaN.
Error in axis>LocSetLimits (line 208) set(ax,…
Error in axis (line 94) LocSetLimits(ax(j),cur_arg);
end
Error in fourbar (line 395)
axis([qstart qstop min(a22) max(a22)]);

Best Answer

Hi Sven (nice name, btw)
Replace the one line:
axis([qstart qstop min(a22) max(a22)]);
With the two lines:
disp([qstart qstop min(a22) max(a22)])
axis([qstart qstop min(a22) max(a22)]);
And then re-run your code. I bet that the last thing before it errors will tell you is that your max(a22) is equal to min(a22).
After that you can probably replace it with:
padding = 0.5; % Just some number that gives you a reasonable axis size
axis([qstart qstop [min(a22) max(a22)] + [-1 1]*padding]);
Thanks, Sven.
Related Question