I would like to create a second order polynomial model using Response Surface Methodology (RSM) for a non-polynomial mathematical model. For example, I would like to represent $f(x)=x_1 + \sin(x_1x_2) - x_2x_3$ in a polynomial using RSM. Is there any software I could use to do that? I tried using MATLAB but I could not figure out which function to use.


2 Answers 2


Have a look at the rsm package in R and the companion paper in 2009 Journal of Statistical Software by its author, Russell Lenth.



The following MATLAB functions come with neither recommendation (yea or nay) or experience from me in these particular tools. I think you can choose from among them depending on your preference as to "how to do business".

There are several tools you can use in MATLAB:



Or you can just form the linear and quadratic terms yourself and use linear least squares.

If you want to venture into the nonlinear parameter domain, which you don't need to do for a quadratic response surface model (but I'm not sure how much success you will have with quadratic RSM - I don't know what your intended use is, but quadratic RSM might not be a very good thing, and will be very lousy for modeling trig functions over a very large domain. Maybe you should just use a Taylor series approximation, paying attention to the remainder term.).



  • 1
    $\begingroup$ @MarkLStone thank you very much for your reply. i intend to use it for design optimization purpose. So i want the modelling to be accurate in addition to being a polynomial. Are there any other options? $\endgroup$ Aug 19, 2015 at 15:25
  • $\begingroup$ If you have an explicit form for the objective function, as for instance with your example f(x), you will be much better off just using that directly in a nonlinear optimizer. E.g., in MATLAB, you can use FMINCON. There are many other nonlinear optimizers available in MATLAB. If you provide more information, or better yet, the actual functions you want to optimize, including any constraints, you can get more specific recommendations. $\endgroup$ Aug 19, 2015 at 15:32
  • $\begingroup$ @MarkLStone Say for example, i want to minimize f(x) = d1 + d2 subject to constraints g1(x) = 1/sqrt(d1*d2) - a < 0 and g2(x) = 1/(d1*d2 + d1^2) - b < 0 using Single Loop Approach (SLA) in Reliability-Based Design Optimization (RBDO). In my case, I would want to express 1/sqrt(d1*d2) and g2(x) = 1/(d1*d2 + d1^2) in polynomial form to find the expanded uncertainty (faster computation when the constraints get more complex). With RSM, I figured, I could achieve that. In addition, it gives me a quantifiable modelling error. Is there any other approach besides RSM? $\endgroup$ Aug 19, 2015 at 15:57
  • $\begingroup$ I don't really know anything about SLA and RBDO, but if you want to minimize f(x) subject to g1(x) <= 0 and g2(x) <= 0 (are those "probabilistic" constraints using deterministic functions?), then use a constrained nonlinear optimizer, such as FMINCON. You will need to make the constraints <=, not <. if you really need them to be < 0, then pick a small positive number, d, and make the constraint g1(x + d <= 0. $\endgroup$ Aug 19, 2015 at 16:08
  • $\begingroup$ You also need to be aware that the optimizer may allow some tolerance, adjustable by the user, for how much the constraint is allowed to be violated, so you can also incorporate that consideration into choice of d. Let the nonlinear optimizer iteratively make whatever approximations it nees to to the objective function and constraints. That is likely much better than trying to do it yourself. If you don't want much "drama" associated with your constraints, you may want to use the SQP (Sequential Quadratic Programming) algorithm option. $\endgroup$ Aug 19, 2015 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.