Search Comments and Ratings


Date File Comment by Comment Rating
12 Dec 2014 Gauss-Jackson Eighth-Order ODE Solver (Fixed Step Size) Gauss-Jackson Eight-Order MultiStep Predictor-Corrector using ODE113 in its startup procedure. Author: Darin Koblick

Darin Koblick (view profile)

Christophe Lauwerys

Nice contribution.

One remark: number of states is hard-coded to 3.

Please replace these references to a variable number of states that you, for instance, can get from y0 at run time.



03 Dec 2014 Representing Polyhedral Convex Hulls by Vertices or (In)Equalities Express bounded polyhedron via equalities/inequalities or vertices. Author: Matt J

Matt J (view profile)

Christophe Lauwerys

Dear Matt,

tried calculating the intersection between a two triangles touching each other in a point but got following error.

Assume can be solved by setting tolerances correct?



>> [A1,b1,Aeq1,beq1]=vert2lcon([2,0;0,2;0,0]);
>> [A2,b2,Aeq2,beq2]=vert2lcon([1,1;2,1;1,2]);
>> V = lcon2vert([A1;A2],[b1;b2],[],[])
Something's wrong. We should have found a recession vector (bb<0).

Comment only
12 Feb 2014 CatStruct2 Concatenates Structures (fields each depth are merged) Author: Hassan

Hassan (view profile)

Christophe Lauwerys

Exactly what I was looking for after first trying out Jos' submission. Unfortunately StrCmpFN on line 116 is undefined resulting in an error.

Comment only
30 Jan 2014 LOGICALFIND Find occurrences of consecutive non-zeros in a vector (v1.0, jan 2014) Author: Jos (10584)

Jos (10584) (view profile)

Christophe Lauwerys

Well documented, elegant and efficient.

29 Jan 2013 Differential Algebraic Equation Solvers A solves a set of differential algebraic equations f(t,y,y')=0 where y'=dy/dt. Author: Tony Roberts Christophe Lauwerys

Very nice.

04 May 2012 HPF - a big decimal class High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico

John D'Errico (view profile)

Christophe Lauwerys

11 Apr 2012 TPROD -- arbitary tensor products between n-d arrays TPROD -- efficiently allows any type of tensor product between 2 multi-dimensional arrays Author: Jason Farquhar Christophe Lauwerys

Great tool, thanks. (how) would it be possible to create a simulink block with this functionality?

Comment only
02 Feb 2012 distance2curve Find the closest point on a (n-dimensional) curve to any given point or set of points Author: John D'Errico

John D'Errico (view profile)

Christophe Lauwerys

As always, great submission, thanks.

Could one easily extend this algorithm to finding the closest point on a surface from given a point in space? Or from another given curve, surface, ... ?

13 Oct 2011 Random Vectors with Fixed Sum Randomly and uniformly generates vectors with a specified sum and values in a specified interval. Author: Roger Stafford

Roger Stafford (view profile)

Christophe Lauwerys

Nice. I'm trying to generate random data within a simplex defined by linear inequality constraints.

Lets say I already have the N vertices of the simplex defined by the inequalities. Is it then correct to first generate a random sample in the interval [0,1] with a sum equal to 1, and then take the inner product of this sample with the vector of vertices?

Something along the lines of:

X = rand(6,2);
k = convhull(X);
plot(X(k,1),X(k,2),'b'), hold on
nv = numel(k)-1; % Nmuber of vertices
X = X(k(1:end-1),:); % Remove repeated first vertex
L = randfixedsum(size(X,1),1000,1,0,1);
Y = L'*X;
plot(Y(:,1),Y(:,2),'r.'), hold off

Maybe I shouldn't trust my vision on this, but the samples don't really look uniformly spread within the simplex. For some reason they only seem to do for a triangle.

Any thoughts?



Comment only
11 Aug 2011 Fractions Toolbox create and manipulate fractions (K+N/D) using exact arithmetic Author: Ben Petschel

Ben Petschel (view profile)

Christophe Lauwerys

Great stuff, but I wonder how your two statements quoted below can be unified.

In other words: how can you define for instance SIGN and ABS for objects that represent polynomials? Not to mention GCD for multivariate polynomials ... Not an expert but do you need Groebner bases for this?




% Non-standard objects must include 0, 1, -1 and require the following
% operations to be defined in order to create a fraction object:
% gcd
% rem
% sign
% abs
% +, - , .*, ./
% ==, <, <=, >, >=, ~=
% The following additional operation definitions are recommended:
% *, .^
% sort
% floor
% factor
% gcd (3-output form)
% rat (if floor(x) or mod(x,1) is not always equal to x)

B) If there exists a suitably defined polynomial object, this toolbox could be used to perform partial fractions.

Comment only
09 Aug 2011 Symbolic polynomials Object-oriented symbolic polynomial manipulation in one or more variables Author: Levente Hunyadi Christophe Lauwerys

sympolys x y


x*y + x - y - 1.000000


x*y - y + 1

is correct.

A bug?

Comment only
02 Nov 2010 groebner manipulate and solve systems of multivariate polynomial equations by computing the groebner basis Author: Ben Petschel

Ben Petschel (view profile)

Christophe Lauwerys

Ben, thanks for your answer.

Could you have a look at another feature/bug:

P = str2poly({'x1*x2*x3'});


ans =

1 1 1 1

??? Index exceeds matrix dimensions.

Error in ==> poly2str at 68
str = [str,varnames{k}]; % print variable name



Comment only
08 Oct 2010 groebner manipulate and solve systems of multivariate polynomial equations by computing the groebner basis Author: Ben Petschel

Ben Petschel (view profile)

Christophe Lauwerys

Dear Ben, seems a little trick, overloading the LE operator for the SYM class, makes your code available for syms quite straightforwardly after all, at least a previous version of your code which did not use SORTROWS yet.

An unrelated remark:

how come




in less then a second, while


does not return at all ?

Comment only
07 Oct 2010 groebner manipulate and solve systems of multivariate polynomial equations by computing the groebner basis Author: Ben Petschel

Ben Petschel (view profile)

Christophe Lauwerys

The first problem I encounter trying to use symbolic expressions is on line 305 in groebner.m

if all(abs(P(:))<=tol)

where P is a symbolic array.

??? Undefined function or method 'le'
for input arguments of type 'sym'.

Not sure how to get around this if possible at all.

Symbolic variables can be anything or can be defined under certain assumptions (see

I guess the LE operator for symbolic variables should check these assumptions in order to come up with an answer.

Comment only
06 Jul 2010 Consolidator Consolidates common elements in x (may be n-dimensional), aggregating corresponding y. Author: John D'Errico

John D'Errico (view profile)

Christophe Lauwerys

Thanks for this great contribution.
However, unless I misunderstood the functionality, I would expect


to return


However, it returns


Is this desired behavior? Wouldn't it make sense to aggregate 3 and 3.01 instead of 1 and 2?

Comment only

Contact us