Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help : how to reverse 2-D lookup table ?

1,064 views
Skip to first unread message

meng yan

unread,
Jan 29, 2010, 3:53:03 AM1/29/10
to

I am trying to reverse a 2D lookup table, i.e.I have T=T(a,b), I need to figure out
a=a(T,b). Anybody ever tried this before? Any ideas?
i.e.a=[1 2 3];b=[3 4 5];T=[1 3 4;4 6 5;2 7 6];
how could I get a as a=[3X3],b=[1X3],T=[1X3]?
Thanks!

John D'Errico

unread,
Jan 29, 2010, 7:03:03 AM1/29/10
to
"meng yan" <ano...@163.com> wrote in message <hju7lf$e34$1...@fred.mathworks.com>...

Has anyone ever "tried it before"?

Why do I need to have tried something that is not
possible in general, or if possible, is trivial to do?

Depending upon the shape of the function T(a,b),
there may be multiple solutions, so this will not
be possible. Even if it is possible because of a
strictly monotonic response, then there may be
only a limited set of solutions for certain values of
T. But for those values of T such the a solution
exists, it will be trivial to compute. Simply fix
the value of b, and interpolate. WTP?

John

meng yan

unread,
Jan 29, 2010, 7:56:06 PM1/29/10
to
"John D'Errico" <wood...@rochester.rr.com> wrote in message <hjuipn$bmr$1...@fred.mathworks.com>...
May be should use others means, the datas of T=T(a,b) are got by inner compute of matlab using Finit Element Analysis ,so I think it cann't simplly get a(a=a(T,b)), but there must have a means to do that . I aways try to use matlab's data process to achieve it ,but all have failed. Who have a good idears ?
meng yan

John D'Errico

unread,
Jan 29, 2010, 8:43:23 PM1/29/10
to
"meng yan" <ano...@163.com> wrote in message <hk0036$c0k$1...@fred.mathworks.com>...

> May be should use others means, the datas of T=T(a,b) are got by inner compute of matlab using Finit Element Analysis ,so I think it cann't simplly get a(a=a(T,b)), but there must have a means to do that . I aways try to use matlab's data process to achieve it ,but all have failed. Who have a good idears ?
> meng yan

It does not matter how this function has been obtained.

If it does not have a simple, single valued behavior,
then NOTHING can give you an inverse relationship.
"Good ideas" are not sufficient to overcome a
mathematical impossibility.

And, if that relationship is a well behaved one then
I'll be forced to repeat myself - it is then trivial to
generate what you wish to see. A simple interpolation
using interp1 will suffice to build your table.

John

ImageAnalyst

unread,
Jan 29, 2010, 9:45:23 PM1/29/10
to
I don't understand this: a(a=a(T,b))
I don't know what you're trying to get.
Are you trying to get a profile or contours or something like that?
For example, let's say that T is a 2D array and for a certain row and
column, T will have a value. Do you then want to find all rows and
column where T = 42 (for example, or some other value)? Something
like this code from the help?

[X,Y,Z] = peaks(30);
surfc(X,Y,Z)
colormap hsv
axis([-3 3 -3 3 -10 5])
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

Of maybe you can simply use the find() function, like
[rows columns] = find(T == 42)

Giving us a better description of what you want will get you better
answers.

meng yan

unread,
Jan 29, 2010, 9:52:08 PM1/29/10
to
"John D'Errico" <wood...@rochester.rr.com> wrote in message <hk02rr$d2$1...@fred.mathworks.com>...

Thanks, John,I got you , it is impossible to got absolutely reverse ,I think i should try other ways. Thank you very much!

meng yan

unread,
Jan 30, 2010, 6:04:06 AM1/30/10
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <c6c16305-02f9-4b5a...@u41g2000yqe.googlegroups.com>...

Hi,ImageAnalyst,I'm sorry to failed to description it clearly.
the question is : I have a matrix T , two vectors a and b,size(T)=101*181,
size(a)=1*101,size(b)=181*1,so I can use 2-D lookup table blocks to got the value of T depending on the input a and b, the most important question is I don't know the relation between T with a and b,only their datas .so if I want to got the value of a , the input of 2-D lookup table block are T and b, how to achieve it? is it possible?
eg.
a=[1 2 3];b=[4 5 6];T=[1 3 5;2 4 6;3 4 5]; a and b as the inputs of lookup table ,output is the value of T, when inputs is 1 and 4,we can got T=1
what I want to do is: T and b as the inputs of lookup table ,output is the value of a,there still don't know their relation.
can you got my idears?
I'm sorry my writting english is so bad.
thanks!

ImageAnalyst

unread,
Jan 30, 2010, 8:47:00 AM1/30/10
to
meng:
I think this will help you:

clc;
close all;
clear all;
workspace; % Display workspace panel.

% Create a 1000 row by 10 column array of
% random integers in the range 0-49.
T = uint8(50*rand(1000, 10));

% Set a column where we'll look for a certain T value.
b = 8;

% Find where T = 42 in this column (column b=8)
aAtTEquals42 = find(T(:,b)==42)

meng yan

unread,
Jan 31, 2010, 5:05:08 AM1/31/10
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <c77ceb5c-3916-4299...@36g2000yqu.googlegroups.com>...

I had tried to use this way,but there is a defualt. I cann't break in points,so this only got some approximate values,you know that 2D lookup table can break in some others values using algorithms ,the real matrix T is more vectors than only T.
when I use the function find(),it only find the values which excist in only T
thanks very much!

ImageAnalyst

unread,
Jan 31, 2010, 8:48:02 AM1/31/10
to
I'm not really sure what you said. It's not understandable to me.
Perhaps are you saying that you need to interpolate and find
fractional indexes because you're giving values that don't exist in
T? If so, I don't think this is what you were saying in the
beginning. But if so, perhaps you need to look into interp2().

Virginia

unread,
Oct 30, 2013, 5:54:14 AM10/30/13
to
Maybe this thread can help, I find it really useful
http://www.mathworks.com/matlabcentral/answers/12809

"meng yan" <ano...@163.com> wrote in message <hju7lf$e34$1...@fred.mathworks.com>...
0 new messages