This is an example of how to set axes positions in a plot in MATLAB®.
Read about the XAxisLocation property in the MATLAB documentation. This feature is available in R2015b or newer.
For more examples, go to MATLAB Plot Gallery
% Define a sine wave x = linspace(-10,4); y = sin(x); % Plot figure plot(x,y) grid on % Add labels and title xlabel('X Axis') ylabel('Y Axis') title('Axes through the origin') % Set the axes to go through the origin set(gca,'XAxisLocation','origin','YAxisLocation','origin')