Skip to main content
1-Visitor
December 10, 2012
Solved

how to contrain a multidfit function

  • December 10, 2012
  • 5 replies
  • 3762 views

Hello,

I'm using the multidfit function to find the regression model needed to fit my multivariant data which works almost perfect.

However some of the regression parameters are not allowed to fall outside certain boundries.

Is there a way to tell mathcad to calculate the best possible regression parameters for a given regression model within certain limits?

many thanks.

Best answer by AndyWesterman

HI Arjen,

2 problems,

1. the conditional equations for a need to be inside the given ... Minerr

2. the initial value of a needs to be in the range

Regards

Andy

5 replies

1-Visitor
December 10, 2012

I have been trying to do the same with a solve block and the minerr function but it doesn't seem to be using the a>0 and a<256 constraint.

12-Amethyst
December 10, 2012

HI Arjen,

2 problems,

1. the conditional equations for a need to be inside the given ... Minerr

2. the initial value of a needs to be in the range

Regards

Andy

19-Tanzanite
December 12, 2012

You need to use minerr instead, and note my comment in this thread about weighting the constraints.

1-Visitor
December 13, 2012

many thanks for all the help. Seems to work properly now.

Is there a difference in weighting the contraints very hard and setting the tolerance for the sheet to an extremely low value?

19-Tanzanite
December 13, 2012

Setting the tolerance changes the number of iterations that will be performed before Mathcad decides it has converged to the solution. That has no effect on the relative importance of the constraints and the residuals. You can think of each residual as a constraint: Y - fitted_Y = 0. That constraint has the same weight as all the other constraints, whether they are other residuals, or constraints you type into the solve block. If you want any particular constraint to have more (or less) importance then you must explicitly weight it relative to the others.

1-Visitor
January 10, 2013

I'm running into an other problem where not all of the contrains are met.

I have added a constrain for B/D<2 but in the included file this is not met.

Am I doing something wrong here?

19-Tanzanite
January 10, 2013

You haven't weighted it. Try

(b/d-2)*10^15<0

1-Visitor
January 10, 2013

thanks for you reply,

I tried adding weight to it like you proposed but then the hole regression goes bezerk that's why i removed the weight for that expression

1-Visitor
January 10, 2013

How can it be possible if I copy the entire sheet to a new document that I do get a more desireable result?

I do have to create a new variable for the "table" because it doesn't copy the content to that new sheet.

But if I create that new variable and copy paste the content of the original sheet it seems to work

bug in mathcad 15?