Prev: Java problem
Next: install Matlab R2010b on Mac?
From: Bruno Luong on 10 Jun 2010 14:14 "Frédéric Bergeron" <frederic.bergeron(a)logiag.com> wrote in message <hur99g$6m7$1(a)fred.mathworks.com>... > > I understand what you're doing, but in the division line where you solves the problem, shouldn't the last term be rhs instead of z? > i.e. sol = B*((M*B)\rhs); instead of sol = B*((M*B)\z); ? Yes. > > Also, I've never utilised the function null. Wouldn't the code work without this function? > i.e. simply write sol = M\rhs; ? No, because the constraints are not generally satisfied, so the two surface will not match et the line. That's what you are asking, no? The constraints are satisfied if and only if A*sol = 0; i.e., sol belongs to span<B>. Bruno
From: Frédéric Bergeron on 10 Jun 2010 14:45 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hura1c$qus$1(a)fred.mathworks.com>... > "Frédéric Bergeron" <frederic.bergeron(a)logiag.com> wrote in message <hur99g$6m7$1(a)fred.mathworks.com>... > > > > > I understand what you're doing, but in the division line where you solves the problem, shouldn't the last term be rhs instead of z? > > i.e. sol = B*((M*B)\rhs); instead of sol = B*((M*B)\z); ? > > Yes. > > > > > Also, I've never utilised the function null. Wouldn't the code work without this function? > > i.e. simply write sol = M\rhs; ? > > No, because the constraints are not generally satisfied, so the two surface will not match et the line. That's what you are asking, no? > > The constraints are satisfied if and only if A*sol = 0; i.e., sol belongs to span<B>. > > Bruno I tried the code with the GPS data of the field I have. It worked fine with the function null, but the plane were not matching at the line if the line i just sol = M\rhs; As you said :P! Since the possibility of separating a field into smaller sections is the main function of my field nivelling program, it helped me a lot.
From: Frédéric Bergeron on 10 Jun 2010 15:20 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hura1c$qus$1(a)fred.mathworks.com>... > "Frédéric Bergeron" <frederic.bergeron(a)logiag.com> wrote in message <hur99g$6m7$1(a)fred.mathworks.com>... > > > > > I understand what you're doing, but in the division line where you solves the problem, shouldn't the last term be rhs instead of z? > > i.e. sol = B*((M*B)\rhs); instead of sol = B*((M*B)\z); ? > > Yes. > > > > > Also, I've never utilised the function null. Wouldn't the code work without this function? > > i.e. simply write sol = M\rhs; ? > > No, because the constraints are not generally satisfied, so the two surface will not match et the line. That's what you are asking, no? > > The constraints are satisfied if and only if A*sol = 0; i.e., sol belongs to span<B>. > > Bruno Hey Bruno, I have a question about your code. when you have writen: Aeq = [0 0 1 0 0 -1; % match z at (x,y)=(0,0) 1 1 1 -1 -1 -1]; % match z at (x,y)=(1,1) B = null(Aeq); To define Aeq do you have to know that the equation of the line was x=y? I believe so, but I want to developp is a code that works for any line. I know 2 points of the line, so I can obtain a vector that passes threw the line. After that, how can I write the matrix Aeq? I propose the following code, but I would like to know if it's correct, because I'm new to the function null so I don't understand all the concepts involved: %I have p1(x,y,z) and p2(x,y,z) are two points from the line %Can I write: Aeq = [p1(1) p1(2) p1(3) -p1(1) -p1(2) -p1(3); % match z at p1? p2(1) p2(2) p2(3) -p2(1) -p2(2) -p2(3)]; % match z at p2? %???
From: Bruno Luong on 10 Jun 2010 15:37 "Frédéric Bergeron" <frederic.bergeron(a)logiag.com> wrote in message <hurdtl$egg$1(a)fred.mathworks.com>... > %Can I write: > Aeq = [p1(1) p1(2) p1(3) -p1(1) -p1(2) -p1(3); % match z at p1? > p2(1) p2(2) p2(3) -p2(1) -p2(2) -p2(3)]; % match z at p2? Almost Let P1 = (x1,y1), P2 = (x2,y2) are two points on the line. At P1, the difference of z between plane left and plane right is: 0 = deltaz(a)P1 = (a1*x1 + b1*y1 + c1) - (a2*x1 + b2*y1 + c2) 0 = [x1, y1, 1, -x1, -y1, -1]*[a1 b1 c1 a2 b2 c2].' The same calculation at P2 leads to 0 = [x2, y2, 1, -x2, -y2, -1]*[a1 b1 c1 a2 b2 c2].' So if Aeq is defined as [x1, y1, 1, -x1, -y1, -1; x2, y2, 1, -x2, -y2, -1] The constraints is Aeq*sol = 0 Bruno
From: Frédéric Bergeron on 10 Jun 2010 16:14
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <huret0$iph$1(a)fred.mathworks.com>... > Let P1 = (x1,y1), P2 = (x2,y2) are two points on the line. At P1, the difference of z between plane left and plane right is: > > 0 = deltaz(a)P1 = (a1*x1 + b1*y1 + c1) - (a2*x1 + b2*y1 + c2) > 0 = [x1, y1, 1, -x1, -y1, -1]*[a1 b1 c1 a2 b2 c2].' > > The same calculation at P2 leads to > 0 = [x2, y2, 1, -x2, -y2, -1]*[a1 b1 c1 a2 b2 c2].' > > So if Aeq is defined as > [x1, y1, 1, -x1, -y1, -1; > x2, y2, 1, -x2, -y2, -1] > > The constraints is > Aeq*sol = 0 > > Bruno Thanks, I think I understand more how to program equations sytem in Matlab. Tell me if I'm wrong, but I just understood that the part of the code with Aeq is just there to set a common separation line between the two planes. When I first read your code, I tought the intersection was set to the line defined by the user, but I now think the line traced by the user and the separation line just share X an Y coordinate but have not the Z. Right? If what I just said is right, the code is even better than I tought for field nivelling... I have another question, if don't bothers you: A future fonction of my nivelling field GUI is that the user would be able to set a cut/fill ratio of the field. This cut/fill ratio means that the planes must be 'lower' than the actual regression make them because in a field, when you cut some soil from a higher part than the plane, it takes actually a bigger amount of soil to fill a hole of the same volume than the higher part. The standard cut/fill ratio is 1.25. Do you have an idea of how can I incorporate this cut/fill ratio into my regression? Tell me if you want more details. |