1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Matlab] Grid renumbering for Matrix

  1. Feb 21, 2013 #1
    1. The problem statement, all variables and given/known data

    I have a matrix A [itex]\in[/itex] R[itex]^{m x m}[/itex] where m = n[itex]^{2}[/itex] and n = 2[itex]^{k}[/itex] +1, k= 0,...,L.
    As in the image attached,the original numbering in the case k=1 is [ 1 2 3 4 5 6 7 8 9], i want the nodes to be renumbered
    to a new numbering T=[2 4 5 6 8 1 3 7 9] (meaning position 2 in original comes first followed by position 4,etc.) and likewise for all k.

    3. The attempt at a solution
    In the first case (9 nodes), i considered the original numbering and created a matrix in that format say Q = reshape(1:m,3,[])'.
    i then considered the Union of both even rows and columns (for k=1, this is 2) i.e. G = (Q(2,:)[itex]\cup[/itex]Q(:,2)). then
    subsequently find the difference with the original, i.e. H= (Q-G).I then store them in a vector as [G H].

    currently it works for k= 1,2 but not any further.
    Any assistance will be appreciated.

    Note:
    From the attached image; Blue(first), Purple(second), gold (third).

    k=1; T =[2 4 5 6 8 1 3 7 9]
    k= 2; T= [2 4 6 7 8 9 10 12 14 16 17 18 19 20 22 24 3 11 13 15 23 1 5 21 25].
     

    Attached Files:

    Last edited: Feb 21, 2013
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: [Matlab] Grid renumbering for Matrix
  1. MATLAB matrix question (Replies: 2)

  2. Matlab - Banded Matrix (Replies: 1)

Loading...