1
votes

I am trying to plot on the same figure the evolution of a function f, with argument x in ]0,1]. I would like to see both the evolution of f far away from 0 and close to 0, on the same figure, with one x axis.

For now I only have two different figures, one using plot with x=[0.1 ... 1], and one using semilogx with x=[1e-9 1e-7 1e-5... 0.1]. I would like to have both graphs on the same figure, with the x axis being logarithmic at the beginning, then linear after a certain x0 (let's say x0=0.1).

I do not want something using plotxx since I want only one x axis.

Do you know if this is possible?

Thank you for your time and help.

1

1 Answers

3
votes

Just plot your y vector without specifying the x vector, this will get you a uniformly spaced plot, then use XTick and XTickLabel to make it work. For example,

x1=logspace(-10,-1,10);
x2=linspace(1,10,10);
y1=x1.^0.25;
y2=1./x2;

plot([y1 y2],'-x') 
xlabels=num2cell([x1 x2]);
set(gca,'XTick',1:numel(x1)+numel(x2),'XTickLabel',xlabels)

enter image description here

If you want to use Latex to format tick labels, you'll need to download a function from the Matlab File Exchange.