Solving the scaling problem.

2 次查看(过去 30 天)
So I have a problem with finding out scaling. I have a vector x1 and a vector x2. I suspect that some elements of x2 might be scaled versions of x1.
I need to see if they are indeed scaled.
so A.x1 = x2, and I need to solve A = x1^-1.x2.
Any ideas how to implement that?

采纳的回答

Matt Fig
Matt Fig 2011-2-14
If
A = [a 0;0 b] % a and b unknowns
Ax = y % The governing relation between known col vects x and y.
then
A = diag(y./x)

更多回答(2 个)

Matt Tearle
Matt Tearle 2011-2-14
If it's just two vectors then you could do
A = x2(1)/x1(1)
norm(A*x1 - x2)
A slightly more generalizable way is
A = x1\x2
norm(A*x1 - x2)
Check to see if the result is on the order of machine roundoff.
  2 个评论
Doug Hull
Doug Hull 2011-2-14
Abhilash said: "Thanks! I tried that, but it doesn't really solve my purpose.
Here's a link form Wiki...this is actually what I need to implement -
http://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors#Examples_in_the_plane
Unequal scaling is the one I'm looking at."
Matt Tearle
Matt Tearle 2011-2-14
OK, in that case, Matt Fig's answer is the simplest (A = diag(x2./x1))... but I'm confused by the use of the words "I suspect", "might be", and "if they are indeed scaled". Two vectors will always be related by such an unequal scaling (unless elements of x1 are zero).

请先登录,再进行评论。


Abhilash
Abhilash 2011-2-16
Thanks guys.
Okay here's what I'm really trying to do. My colleague has these image pairs that will be, in a behavioural experiment, be matched by human subjects as to how similar they think they are (color, shape, use, category etc etc). Before that she wants to do a shape similarity analysis. So what I did was a ratio matching. I imposed the boundary on a "grid" whose "boxes" are 4px by 3 px and for each image, calculated the distance from each point on the boundary within a box to points on the box and took the ratio of those distances of image 1 to 2. I then said, if the ratio lies between 0,9 and 1,1 , give me a 1 in a vector called hit. Summed it up, divided by the length of hit and multiplied by 100 for a percentage.
The trouble is, if I have a unit circle and a circle scaled 0,7 times the unit circle, my algorithm does not show 100% similarity, even though both of them are circles. I want to see if there's a scaling anywhere. Of course, the images are all objects like a screw-driver, an apple, a banana etc.
If I could somehow compensate for scaling, it would help. My idea was then to use this eigenvalue scaling. If the non-zero eigenvalues are all the same, then that is the amount by which that part of the image has been scaled w.r.t to the other image, and hence that part is entirely similar in shape. Then I would just compensate such that in my ratio, I get a 1 at that position.
Makes sense?

类别

Help CenterFile Exchange 中查找有关 Mathematics and Optimization 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by