MATLAB: How to set up the axis values in a plot

axesplotyaxis

Hi! I'm working with some signal plots and I want to see how I can set up the axes so I can have a better view of the plots. For example, I have the attached plot:
How can I adjust the axes to have a more detailed view of the signals?
Thank you!

Best Answer

Hello Agustin,
I'm not entirely certain what you mean by "a more detailed view of the signals". If you'd like to just thin out the line so that changes in direction are more visible, you can just add a 'LineWidth parameter when plotting. For example:
plot(rand(100,1), 'LineWidth', 0.2)
If you are looking to zoom in on various areas of interest, you can do that by modifying the axis limits. For example, for the second axes you might use:
xlim([18 40])
ylim([-2 2])
If the plots lend themselves to a different scale, you may get more detail out of them with logarithmic scale axes. For example, you could try plotting the first line with semilogy.
Of course, you can always make the figure window larger, either manually or by changing the 'Position' property of the figure. You can also pan and zoom on the plots manually using the tools in the toolbar.
Hope this helps.
-Cam