0

I have two tensors (12 x 128 x 10) samples. The second tensor contains some samples of the first tensor and other samples. Similar to that example with matrices:

A = [1 2 3 4 5 6; 11 12 13 14 15 16]
B = [4 5 6 7 8 9; 14 15 16 17 18 19]

When I intersect of my two tensors, I get ~1080 values that are the same, which is expected since:

column 1 to 78 from tensor 2 = column 50 to 128 from tensor 1 
      tensor2 (:,1:78, 1:10) = tensor 1(:, 50:128, 1:10).

However, I do the mean of the two tensors in the third dimension

m1 = mean(tensor1, 3)
m2 = mean(tensor2, 3)

Then the values of the mean are different. I expect:

m2 (:, 1:78) = m1(:,50:128).

But the values are different. Why is this happening?

nabrugir
  • 1,839
  • 2
  • 22
  • 38
  • I don't see any mistakes in your code. Can you post a minimal 3D example that duplicates the problem? e.g. `tensor2(:,1:10,1:2)` and `tensor1(:,50:59,1:2)` ? – Geoff Jan 21 '16 at 16:10
  • 3
    My bet: [Why is 24.0000 not equal to 24.0000 in MATLAB?](http://stackoverflow.com/questions/686439/why-is-24-0000-not-equal-to-24-0000-in-matlab) – Luis Mendo Jan 21 '16 at 16:13
  • what do you get when you type `max(max(abs(m2(:,1:78) - m1(:,50:128))))` – Suever Jan 21 '16 at 18:17

0 Answers0