From: alfann on 24 May 2010 06:45 Hi there, If I have this matrix: U1=[22 22 22 22; 66 77 88 99; 10 11 12 13; 14 15 16 17; 0 0 0 0] and U2=[0 0 0 0; 0 0 0 0; 0 1 0 0; 0 1 0 0; 0 0 0 0] Then I want calculate U3 which is equal to: ___________________________________ for j = 1:a for i = 2:b-1 if (j==1) U3(i,j)=( U1(i,j+1)+ U1(i-1,j)+ U1(i,j+1)+ U1(i+1,j))/4; elseif (j==a) U3(i,j)=( U1(i-1,j)+ U1(i,j-1)+ U1(i,j-1)+ U1(i+1,j))/4; elseif ((j>=2)&&(j<=(a-1))) U3(i,j)=( U1(i+1,j)+ U1(i,j-1)+ U1(i,j+1)+ U1(i-1,j))/4; ___________________________________ but with this condition: The location of U1(i,j) must be equal to zero in U2
From: alfann on 24 May 2010 07:40 Could be my question is diffecult! Why no body help me? waiting for you... Please
From: us on 24 May 2010 12:01 alfann <alfann.net(a)hotmail.com> wrote in message <692126139.214809.1274712345099.JavaMail.root(a)gallium.mathforum.org>... > Hi there, > If I have this matrix: > > U1=[22 22 22 22; 66 77 88 99; 10 11 12 13; 14 15 16 17; 0 0 0 0] > > and > > U2=[0 0 0 0; 0 0 0 0; 0 1 0 0; 0 1 0 0; 0 0 0 0] > > Then > I want calculate U3 which is equal to: > ___________________________________ > > for j = 1:a > for i = 2:b-1 > > if (j==1) > U3(i,j)=( U1(i,j+1)+ U1(i-1,j)+ U1(i,j+1)+ U1(i+1,j))/4; > > elseif (j==a) > U3(i,j)=( U1(i-1,j)+ U1(i,j-1)+ U1(i,j-1)+ U1(i+1,j))/4; > > elseif ((j>=2)&&(j<=(a-1))) > U3(i,j)=( U1(i+1,j)+ U1(i,j-1)+ U1(i,j+1)+ U1(i-1,j))/4; > > ___________________________________ > > > but with this condition: > The location of U1(i,j) must be equal to zero in U2 for this filter, why not add another conditional on top if ~u2(i,j) % your flow end us
From: Walter Roberson on 24 May 2010 12:10 alfann wrote: > Could be my question is diffecult! > Why no body help me? 1) It is a holiday morning here and forecast to rain in less than an hour so I have to go cut the grass 2) Your question was not understandable. You said that U1 at a certain position had to be 0 in the calculation, but U1 at that position is not involved in the formula for the calculation and is not an output of the calculation. With the information you gave, it's value is irrelevant. What I _suspect_ is that you are attempting to solve a differential equation -- or at least that's what I seem to remember someone referring to it as the last time a similar discussion came up, 3 to 5 weeks ago. Unfortunately, I do not find the relevant posting easily and I do not have time to look for it. You need to correct your question before anyone can answer it.
From: alfann on 24 May 2010 08:14
Could you please explain it more? becuase I did understand. Please |