I'm confused by the following output. Below is my code. I used pause to check the result of the last command step by step.
I(95:101,890:901,2).*(v_fix(95:101,890:901,1)-ones(7,1)*v(2,890:901))
pause()
(1-I(95:101,890:901,2))*Q
pause()
invent(:,:,1)=I(:,:,2).*(v_fix(:,:,1)-ones(a_length+1,1)*v(2,:))+(1-I(:,:,2))*Q;
invent(95:101,890:901,1)
pause()
invent(:,:,1)
pause()
I truncated the matrix, so it's easier to see the results. Here's the result for the 1st command
ans =
0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405
0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409
0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413
0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418
0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422
0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426
0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431
Here's the result of the 2nd command:
ans =
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
And the third:
ans =
0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405
0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409
0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413
0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418
0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422
0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426
0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431
And part of the final (colum 886 to 900, row 95 to 101)
0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405 0.0405
0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409 0.0409
0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413 0.0413
0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418 0.0418
0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422 0.0422
0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426 0.0426
0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431 0.0431
However, if I delete the display of invent(95:101,890:901,1),
I(95:101,890:901,2).*(v_fix(95:101,890:901,1)-ones(7,1)*v(2,890:901))
pause()
(1-I(95:101,890:901,2))*Q
pause()
invent(:,:,1)=I(:,:,2).*(v_fix(:,:,1)-ones(a_length+1,1)*v(2,:))+(1-I(:,:,2))*Q
pause()
I got the following result for the last command (colum 886 to 900, row 95 to 101):
-0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405 -0.0405
-0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409 -0.0409
-0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413 -0.0413
-0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418 -0.0418
-0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422 -0.0422
-0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426 -0.0426
-0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431 -0.0431
I don't understand why the result suddenly turns negative. I thought the semicolon only controls whether to output the result.