MATLAB: Negative x axis meaning

datagraphnegativevector

Hello
I have a vector plot created from multiple functions. The x axis values are incorrect and some are negative. Does matlab assign x axis in order to generate a suitable graph?
GS

Best Answer

This is confusing as a question. You have a plot of some numbers. Some of them are negative. Of course MATLAB will extend the axis out to include the values you plotted. That some of them are negative and you don't want them to be is irrelevant, since MATLAB just plots what you tell it to plot.
If you don't want anything negative, then force it to be so in advance. Or correct what ever bug was there to prevent that from happening.
I suppose, you can always set the axis limits after the fact, effectively ignoring any negative values. But that just closes your eyes to the problem. I would suggest fixing the problem, rather than just pretending it does not exist.
Related Question