i need to compare a matrix with a static table
Show older comments
X= [11.9000 10.3000 9.5000
10.3000 8.7000 9.5000
9.5000 7.9000 9.5000
11.1000 9.5000 9.5000]
Y= [7.9 186.46
8.7 205.17
9.5 223.84
10.3 242.49
11.1 261.11
11.9 279.69]
Z=[7.9 196.39
8.7 216.11
9.5 235.79
10.3 255.45
11.1 275.07]
A=[9.5 247.74
10.3 268.4
11.1 289.03
11.9 309.62
12.7 330.19]
i need to comare the first column from X with the first column from Y
second column from X with the first column from Z
third column from X with the first column from A
and choose the corrsponding number from the second column from Y, Z and A correspondingly
RESULT =[279.69 255.45 247.74
242.49 216.11 247.74
223.84 196.39 247.74
261.11 235.79 247.74]
Accepted Answer
More Answers (1)
Bjorn Gustavsson
on 20 Jun 2019
0 votes
OK, how do you need to compare the first column of X with the first column of Y? Correlation? length of difference-vector? Angle between vectors? If you describe what you need to do answers will come that much easier.
After a little bit of inspection ot seems you need to find the most identical component? If this is so, I suggest that you have a look at min, abs, using those two function would help you solve the task for one element of X and one column of Y Z and A? Once you worked that out use loops to repeat that step for all components in X.
HTH
1 Comment
Omar Almahallawy
on 20 Jun 2019
Categories
Find more on Elementary Math in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!