|
"John D'Errico" <woodchips@rochester.rr.com> wrote in message <hegdj8$a4o$1@fred.mathworks.com>...
> "S?ren Sieberling" <seuren83@hotmail.com> wrote in message <heg9nf$gma$1@fred.mathworks.com>...
> > "Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <heehqo$lm8$1@fred.mathworks.com>...
> > > Dear Soeren!
> > >
> > > > I have two lookup tables, such that
> > > >
> > > > Ca = Ca(a,b) and Cb = Cb(a,b).
> > > >
> > > > I however want to invert them, such that I get,
> > > >
> > > > a = a(Ca,Cb) and b = b(Ca,Cb).
> > > >
> > > > This should be possible, but I can't manage to find a way. Does somebody have an idea? Thanks in advance.
> > >
> > > Do I understand correctly: Ca and Cb are matrices, while a and b are vectors in the first equation. In the 2nd equation Ca and Cb are vectors and a and b are the matrices?
> > > I assume that your a = a(Ca, Cb) is a matrix also and it can be defined uniquely. So can you give an example with [3x3] arrays?
> > >
> > > I'm thinking on something like:
> > > data = 1:9; data = data(randperm(9)); % Test data
> > > Table = reshape(data, 3, 3);
> > > InvTable(Table) = 1:9;
> > >
> > > Kind regards, Jan
> >
> > Hello,
> >
> > Thanks for your replies. Indeed what you are assuming is correct. I will give an example
> >
> > a = [ 1 2 3]
> > b = [-1 0 1]
> >
> > Ca = [0.1 0 0.1; 1.1 1.0 1.1; 2.1 2.0 2.1];
> > Cb = [-1 0 1; -1.1 0 1.1; -1.2 0 1.2];
> >
> > Where b can be seen as column index and a as row index. I want to get something like:
> >
> > Ca = [0 1 2]
> > Cb = [-2 0 2]
> >
> > a = [3x3]
> > b = [3x3]
> >
> > with Cb as column index and Ca as row index. I hope this clears up my problem. Every combination of Ca and Cb should be able to specify a value for a and b uniquely.
> >
> > Kind regards,
> > Soeren
>
> No! You cannot do that, simply invert this general,
> arbitrary nonlinear relationship into a nice simple
> relationship that you can easily plot! There is no
> reason to assume that a well defined (unique)
> inverse even exists at every point in the plot you
> describe. Under certain conditions, you might be
> able to achieve this goal for a limited (probably
> non-rectangular) domain of the (a,b) plane.
>
> The best that you can do in general is for a given
> pair of levels for Ca and Cb, you can compute
> corresponding values of a and b that yield the
> desired Ca and Cb by interpolation. There may be
> multiple solutions to this problem though.
>
> For this, do as I suggested. Use contourc twice. Get
> contour polygons for Ca and then also for Cb at
> your desired values of those parameters. Then use a
> tool that can find all intersections of these plane
> curves in (a,b). Doug Schwarz has written a nice
> one, found on the file exchange.
>
> John
Thanks big time John. This is exactly what I was looking for. What I should have also told you is that from physical considerations I know for a fact that the contour lines will only run from "left" to "right" in the Ca matrix and from "top" to "bottom" in the Cb matrix. Hence for each a and b the value of Ca and Cb is defined, the opposite is also true.
The tool written by Schwarz is exactly what I needed.
Kind regards,
Soeren
|