MATLAB: I would like to have two y-axis and corresponding y-axis ticks and ticks values but with a single set of data points.

axis tickloglog

What I am trying to achieve is fully detailed in the attached file. I have two variables which I normalized by a constant and plotted on y axis (left) against an independent variable on x-axis. Both axes have logarithm scale (base 10). However, I want to add a second y-axis (right) also with logarithm scale (base 10) which will normalize the same two dependent variables above by another constant and have the values of its axis' ticks to correspond to those of the y-axis (left) using the same set of data points of the two dependent variables vs independent variables (so single set of data points for each dependent variable). I have tried and couldn't manage to get the ticks and tick values of the y-axis (right) to work and to correspond to those of the y-axis (left).

Best Answer

This works:
x = logspace(-3, -1, 10); % Create Data


y1 = logspace(-10, -5, 10); % Create Data
y2 = logspace(-10, -5, 10) + 1E-11; % Create Data
figure(1)
Ax = gca;
yyaxis left
loglog(x, y1, 'pb')
set(Ax, 'YTick',logspace(-10,-5,6))
yyaxis right
loglog(x, y2, 'pr')
set(Ax, 'YTick',logspace(-10,-4,6), 'YTickLabel',{'a','b','c','d','e','f'})
It took some time to set the axis tick labels correct, and as the result, they are a bit fragile.
I leave the y-axis labels to you. They will require that you use LaTeX, so I refer you to The Not So Short Introduction to LaTeX2e (link). That link is to the English language version. There are versions of the LaTeX documentation in other languages.