MATLAB: How to choose which data correspond to the X and Y axes using EZPLOT in MATLAB (R2013a)

axesdependentezplotindependentlabelsMATLABvariable

I would like to plot a function of two variables 'x' and 'y', but would prefer to have control as to which variable corresponds to which axis. For example, I would like to have the Y-data on the horizontal (X) axis. How can I do that?

Best Answer

EZPLOT plots the variables in string expressions alphabetically. To avoid this ambiguity, you would specify the order using an anonymous function:
>> subplot(1,2,1)
>> ezplot('1./y - log(y) + log(-1+y) + x - 1')
>> subplot(1,2,2),
>> ezplot(@(y,x)1./y - log(y) + log(-1+y) + x - 1)
Related Question