Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Successive Matrix Midpoint Operations
Replies: 5   Last Post: Mar 21, 2013 5:58 PM

 Messages: [ Previous | Next ]
 Konstantine Posts: 34 Registered: 5/3/11
Re: Successive Matrix Midpoint Operations
Posted: Mar 20, 2013 3:51 PM

> A couple of questions/clarifications - First, why wouldn't the first result be:
> [1;NaN;NaN;NaN;5;NaN;NaN;NaN;9]
> Second, is your vector (matrix) ALWAYS of odd length? Even so, what if its something like:
> [1;NaN;NaN;NaN;NaN;NaN;7]
> what do you want on the second iteration of:
> [1;NaN;NaN;4;NaN;NaN;7]
> Do you want:
> [1;2.5;2.5;4;5.5;5.5;7]>
> or
> [1;2;3;4;5;6;7]

Hi!

I have no idea why I put 5.5 that first time around, it would indeed be 5.

The matrix should always divide evenly by twos between midpoints, so I suppose it would always be odd. The matrices will follow a 2x-1 pattern, so: 3, 5, 9, 17 length matrix.

I've figured out how to make it work in a clunky way with this 17 length matrix:

%Establish the original matrix
POINTS = NaN (17,1);
%Populate first and last values:
POINTS(1) = 1;
POINTS(end) = 17;

%4 iterations for a matrix of length 17
for h = 1:4
idxx = find(~isnan(POINTS(:))); %find the indexes of values
cnt = 2; %start a counter
for j = idxx(1:end-1)' %start from index of 1 to second to last index value

x = POINTS(j); %first point
y = POINTS(idxx(cnt)); %second point
m = mean([x y]); %mean

POINTS(mean([j idxx(cnt)])) = m; %location to put new value
cnt = cnt+1; %increase count
end
end

Any input is appreciated!

Date Subject Author
3/20/13 Konstantine
3/20/13 Curious
3/20/13 Konstantine
3/20/13 Bruno Luong
3/21/13 Konstantine
3/21/13 Bruno Luong