MATLAB: Plot and scale very small numbers

MATLABplotscalesmall numbers

Hi all,
I am interested in ploting the following y-axis (from 10^-16 to 10^-11) in Matlab:
Sample_plot.PNG
I use the following codes, but I did not get the nicely spaced y-axis as above. What changes should I amend to the codes to get the above y-axis for my y-data?
figure
plot(x,y,'o','r')
ylim([10^-17 10^-10])
yticks([10^-16 10^-15 10^-14 10^-13 10^-12 10^-11])
Thank you for your suggestions.

Best Answer

You need to make the yscale log.
figure;
h = axes;
h.YScale = 'log'; % <------- or set(h, 'YScale', 'log')
ylim([10^-17 10^-10])
yticks([10^-16 10^-15 10^-14 10^-13 10^-12 10^-11]) % (not needed)
Related Question