MATLAB, what is the best way to trace a boarder in a matrix that is changing each step?
问题 I want to calculate the average slope or gradient at each iteration in such a matrix. a=[ 10 9 8 7 6 5 5; 9 9 8 7 8 5 5; 8 8 7 7 5 5 5; 7 7 7 6 5 5 5; 6 6 6.6 5 5 5 5; 6 6 6.1 5 5 5 5; 6.3 5 5 5 5 5 5] Where I am wanting to find the slope or gradient between the a(1,1) position during each step and at each point that boarders a value of 5. Each iteration the position of the 5's changes and so do the other values. After doing so I will then average the slope. I haven't encountered a problem