Rank: 5 based on 2949 downloads (last 30 days) and 51 files submitted
photo

John D'Errico

E-mail
Company/University
Retired

Personal Profile:

Mainly retired from Eastman Kodak. (Of course, Kodak itself is now semi-retired. I don't think I had any influence in that.) I still write MATLAB code as I find something interesting, but I DON'T answer your questions, and I do NOT do homework. Your homework is YOUR problem, not mine. Do NOT e-mail me with your homework problems or student projects. When I'm not doing something with MATLAB, you might find me playing bridge.

Professional Interests:
Bridge, MATLAB, numerical analysis, mathematical modeling

 

Watch this Author's files

 

Files Posted by John View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
27 Feb 2013 Screenshot distance2curve Find the closest point on a (n-dimensional) curve to any given point or set of points Author: John D'Errico arclength, interpolant, distance, interpolation, curve, space curve 61 6
  • 5.0
5.0 | 3 ratings
02 Jan 2013 Inverse (integrated) gradient Vectorized & fully sparse 1-d, 2-d, & 3-d integrated gradients Author: John D'Errico integration, simpsons rule, gradient, cumulative, trapezoidal rule, numerical integration 31 5
  • 5.0
5.0 | 4 ratings
10 Dec 2012 HPF - a big decimal class High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico hpf, multiple precision, big decimal, floating point, arithmetic, mathematics 39 5
  • 5.0
5.0 | 6 ratings
06 Sep 2012 Screenshot Inhull Efficient test for points inside a convex hull in n dimensions Author: John D'Errico convex hull, inhull, hull, tsearch, tsearchn 60 33
  • 4.57143
4.6 | 22 ratings
16 Aug 2012 Screenshot IPDM: Inter-Point Distance Matrix An efficient and accurate Inter-Point Distance Matrix Author: John D'Errico distance, interpoint, distances, euclidean, metrics, nearest neighbor 45 11
  • 4.57143
4.6 | 7 ratings
Comments and Ratings by John View all
Updated File Comments Rating
16 May 2013 fminsearchbnd, fminsearchcon Bound constrained optimization using fminsearch Author: John D'Errico

Fminsearchcon uses your objective function, which for 5 parameter models, must take vector input. Thus it will pass in a vector x to the objective function that has 5 elements here. The constraint function must then also accept a vector of length 5. So your call to fminsearchcon might look like this:

[x,fval]=fminsearchcon(@fit,x0,lb,ub,[],[],@(x) 2.3*(x(4)^2+x(3))^0.5-x(5)-x(2));

16 May 2013 SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico

No. SLM does NOT use truncated power functions! These are generally a numerically poor way to implement a spline, even only a cubic spline.

SLM uses a Hermite formulation, which personally, I've always preferred as they are easy to look at and understand the shape just by looking at the parameters since they are parameterized by function values and derivatives at the knots. Its just my personal preference though, since a spline by any other basis is still a spline.

As far as monotonicity or concavity applying only over a restricted range, you can do so using SLM directly. Read the help for slmset. It says (in part):

'increasing' - controls monotonicity of the function
= 'off' --> No part of the spline is constrained to be an
increasing function.
= 'on' --> the function will be increasing over its entire domain.
= vector of length 2 --> denotes the start and end points of a
region of the curve over which it is monotone increasing.
= array of size nx2 --> each row of which denotes the start
and end points of a region of the curve over which it is
monotone increasing.

So if you wish a constraint to apply only over a portion of the curve, you can specify the interval. This same approach applies to the concavity constraints. If that constraint would indicate the curve be monotonic over only part of a knot interval, I do stretch it to require monotonicity over a complete knot interval. So you cannot stop midway between a pair of knots. In that case, simply add a knot.

13 May 2013 SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico

Erick - sorry, but I don't have Meyer's paper to know what their terminology is. Degree 3 is a cubic spline in SLM.

I do now recall the Ramsey paper as a useful one, but most of my old collection of papers was left behind when I retired from Kodak.

If you set 30 knots, then the result is ONE cubic spline. A cubic spline means you have a curve that is composed of piecewise segments, thus 30 pieces, that are each connected at the knots, so they are adequately smooth across those tie points.

The current version of SLM did not return the final parameter generated from cross validation, but I've modified it so that it will do so. slm.stats.finalRP will now contain that value. I'll upload the new version in the morning. It was due for an update anyway.

11 May 2013 SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico

Erick - sorry, but I'm not doing active research in this area, and I don't have access to any new papers. I recall a paper by Wright and Wegman about constrained regression splines, but that dates back over 30 years. The work I did in developing SLM was mainly my own, based on my consulting activities, though I never published any papers on the topic.

10 May 2013 SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico

Erick - Yes, that paper is where I (long ago) read about the region of monotonicity for a cubic. I use a multi-sided (6 or 7 sides, I can't recall the exact number at the moment) polygonal approximation to the region that contains all monotonic cubic segments.

So is the theory used in SLM exactly that set forth by Fritsch and Carlson? Not exactly, because they describe an interpolating spline, and because I use a different, slightly more inclusive region than they implemented.

As far as knot placement goes, this is traditionally the biggest problem of this class os spline. A knot belongs where the third derivative changes, but that is quite difficult to identify. The idea behind SLM is typically to use generally more knots than you really need, but then to apply artful constraints on the shape of the curve, based on your knowledge of the process. This is where SLM excels, in allowing you to bring virtually any information that you may have about the relationship into the modeling process.

Comments and Ratings on John's Files View all
Updated File Comment by Comments Rating
21 May 2013 SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico erick

Thank you, John. According to your suggestion, I have fitted my data again, but unfortunately, the results is worse than seperately fitting the two parts of the curve. I made a simple simulation, but I still got the similar result. Would you please take a few minutes to have a look at my simulation data, I will send it to you by email. Thank you.

I found the code written by Meyer on this web site "http://www.stat.colostate.edu/~meyer/srrs.htm", but it was written in R code, not matlab. I think I should learn R code these days. Meyer also did not give out how to fit the data with half convex and half concave, it seems still a long way for me to get out. Would you please give me some suggestion? Thank you.

I am looking forward to your new reply, Thank you again.

18 May 2013 Adaptive Robust Numerical Differentiation Numerical derivative of an analytically supplied function, also gradient, Jacobian & Hessian Author: John D'Errico Munk-Nielsen, Anders

Absolutely awesome work! So easy to use, brilliantly done. This is probably the best thing to happen to mankind since sliced bread. And to put it up for free? John, you sir are a good man!

17 May 2013 fminsearchbnd, fminsearchcon Bound constrained optimization using fminsearch Author: John D'Errico Campos Duque, Alvaro

Yeah, it works =) Thank u so much!!

16 May 2013 fminsearchbnd, fminsearchcon Bound constrained optimization using fminsearch Author: John D'Errico D'Errico, John

Fminsearchcon uses your objective function, which for 5 parameter models, must take vector input. Thus it will pass in a vector x to the objective function that has 5 elements here. The constraint function must then also accept a vector of length 5. So your call to fminsearchcon might look like this:

[x,fval]=fminsearchcon(@fit,x0,lb,ub,[],[],@(x) 2.3*(x(4)^2+x(3))^0.5-x(5)-x(2));

16 May 2013 fminsearchbnd, fminsearchcon Bound constrained optimization using fminsearch Author: John D'Errico Campos Duque, Alvaro

Congrats again for the useful function John. I just have a qestion: i'm trying to use fminsearchcon in a 5 parameter function i've created:

function error=fit(parameters)
x1=parameters(1);
x2=parameters(2);
x3=parameters(3);
x4=parameters(4);
x5=parameters(5);
(...) Here there is a long script but, at the end, the important thing are the input and outputs (...)

What I wonder is to find the parameters that optimize the error function. These parameters are interelated by the non-linear constrain:

-2.3*(x4^2+x3)^0.5+x5+x2>0

The problem is that I don't know how to implement this constrain, the examples I have seen are just with one parameter. I have tried this:

x0=[0.5,0.05,0.05,1,0.5];
lb=[0,0,0,0,0];
ub=[2,1,1,10,5];
[x,fval]=fminsearchcon(@fit,x0,lb,ub,[],[],@(x2,x3,x4,x5) 2.3*(x4^2+x3)^0.5-x5-x2)

But, of course, it doesn't recognise what is x2, x3, x4, or x5 because it is defined nowhere.

Any clue?? Thanks in advance! :)

Top Tags Applied by John
interpolation, curve, distance, modeling, regression
Files Tagged by John View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
27 Feb 2013 Screenshot distance2curve Find the closest point on a (n-dimensional) curve to any given point or set of points Author: John D'Errico arclength, interpolant, distance, interpolation, curve, space curve 61 6
  • 5.0
5.0 | 3 ratings
02 Jan 2013 Inverse (integrated) gradient Vectorized & fully sparse 1-d, 2-d, & 3-d integrated gradients Author: John D'Errico integration, simpsons rule, gradient, cumulative, trapezoidal rule, numerical integration 31 5
  • 5.0
5.0 | 4 ratings
10 Dec 2012 HPF - a big decimal class High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico hpf, multiple precision, big decimal, floating point, arithmetic, mathematics 39 5
  • 5.0
5.0 | 6 ratings
06 Sep 2012 Screenshot Inhull Efficient test for points inside a convex hull in n dimensions Author: John D'Errico convex hull, inhull, hull, tsearch, tsearchn 60 33
  • 4.57143
4.6 | 22 ratings
16 Aug 2012 Screenshot IPDM: Inter-Point Distance Matrix An efficient and accurate Inter-Point Distance Matrix Author: John D'Errico distance, interpoint, distances, euclidean, metrics, nearest neighbor 45 11
  • 4.57143
4.6 | 7 ratings

Contact us