From: Amir on
How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?

Something like this BUT with a reverse x-axis for both curves:

x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx');

Thanks!
From: us on
"Amir " <albalbaloo(a)gmail.com> wrote in message <hrbv10$3ti$1(a)fred.mathworks.com>...
> How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?
>
> Something like this BUT with a reverse x-axis for both curves:
>
> x = 0:0.01:20;
> y1 = 200*exp(-0.05*x).*sin(x);
> y2 = 0.8*exp(-0.5*x).*sin(10*x);
> [AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx');
>
> Thanks!

one of the solutions

% create your plot, then
set(AX,'xdir','reverse');

us
From: Amir on
"us " <us(a)neurol.unizh.ch> wrote in message <hrbvuk$4b3$1(a)fred.mathworks.com>...
> "Amir " <albalbaloo(a)gmail.com> wrote in message <hrbv10$3ti$1(a)fred.mathworks.com>...
> > How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?
> >
> > Something like this BUT with a reverse x-axis for both curves:
> >
> > x = 0:0.01:20;
> > y1 = 200*exp(-0.05*x).*sin(x);
> > y2 = 0.8*exp(-0.5*x).*sin(10*x);
> > [AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx');
> >
> > Thanks!
>
> one of the solutions
>
> % create your plot, then
> set(AX,'xdir','reverse');
>
> us

Thanks, I knew this. The problem with this command is: it will just reverse (x,y1) set and not (x,y2) set.
From: someone on
"Amir " <albalbaloo(a)gmail.com> wrote in message <hrc0p9$sr7$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message <hrbvuk$4b3$1(a)fred.mathworks.com>...
> > "Amir " <albalbaloo(a)gmail.com> wrote in message <hrbv10$3ti$1(a)fred.mathworks.com>...
> > > How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?
> > >
> > > Something like this BUT with a reverse x-axis for both curves:
> > >
> > > x = 0:0.01:20;
> > > y1 = 200*exp(-0.05*x).*sin(x);
> > > y2 = 0.8*exp(-0.5*x).*sin(10*x);
> > > [AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx');
> > >
> > > Thanks!
> >
> > one of the solutions
> >
> > % create your plot, then
> > set(AX,'xdir','reverse');
> >
> > us
>
> Thanks, I knew this. The problem with this command is: it will just reverse (x,y1) set and not (x,y2) set.

Are you sure? It worked for me.
MATLAB version R2007b.
From: Amir on
"someone" <someone(a)somewhere.net> wrote in message <hrc8ak$s7v$1(a)fred.mathworks.com>...
> "Amir " <albalbaloo(a)gmail.com> wrote in message <hrc0p9$sr7$1(a)fred.mathworks.com>...
> > "us " <us(a)neurol.unizh.ch> wrote in message <hrbvuk$4b3$1(a)fred.mathworks.com>...
> > > "Amir " <albalbaloo(a)gmail.com> wrote in message <hrbv10$3ti$1(a)fred.mathworks.com>...
> > > > How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?
> > > >
> > > > Something like this BUT with a reverse x-axis for both curves:
> > > >
> > > > x = 0:0.01:20;
> > > > y1 = 200*exp(-0.05*x).*sin(x);
> > > > y2 = 0.8*exp(-0.5*x).*sin(10*x);
> > > > [AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx');
> > > >
> > > > Thanks!
> > >
> > > one of the solutions
> > >
> > > % create your plot, then
> > > set(AX,'xdir','reverse');
> > >
> > > us
> >
> > Thanks, I knew this. The problem with this command is: it will just reverse (x,y1) set and not (x,y2) set.
>
> Are you sure? It worked for me.
> MATLAB version R2007b.

I am using R2009b and if I run the below lines:

x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx');
set(AX,'xdir','reverse');

It is working now!! What happened!!