Search code examples
matlabmatlab-figure

Cartesian plane in Matlab


How to make Matlab draw a plane like this? Can't find the settings for plot command in documentation. Maybe there is another command for planes like this?

enter image description here


Solution

  • If you are using MATLAB 2015b and higher, check the option of AxisLocation.

    figure
    hold on
    axis([-1 1 -1 1])
    quiver(0,0,-1,1,'k')
    quiver(0,0,1,1,'k')
    
    ax = gca;
    
    ax.XAxisLocation = 'origin';
    ax.YAxisLocation = 'origin'; 
    

    enter image description here