Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Curious

Posts: 1,995
Registered: 12/6/04
Re: Successive Matrix Midpoint Operations
Posted: Mar 20, 2013 1:58 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"K" wrote in message <kicrhl$2r2$1@newscl01ah.mathworks.com>...
> I'm having a tough time understanding how to do this properly.
>
> Imagine I have a matrix = NaN(9,1) with values at matrix(1,1) = 1 and matrix(end, 1) = 9.
> So: [1;NaN;NaN;NaN;NaN;NaN;NaN;NaN;9]. I want to perform a mean of the numbers and place it in the center of the matrix so: [1;NaN;NaN;NaN;5.5;NaN;NaN;NaN;9], then I want to take a mean from the first to the center value and the mean from the center to the last value, so: [1;NaN;3.25;NaN;5.5;NaN;7.25;NaN;9] and so on until I have this: [1;2.125;3.25;4.375;5.5;6.35;7.25;8.125;9]



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]



>
> I'm using mean as just an example in this case; I wish to perform other operations as I go, so the result won't be as uniform as described above, but the pattern is the same.
>
> Thanks for any insight,
> KP




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.