cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

how to contrain a multidfit function

ptc-4699986
1-Newbie

how to contrain a multidfit function

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

11 REPLIES 11

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.

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

RichardJ
19-Tanzanite
(To:ptc-4699986)

Unlike with minimize, with minerr the constraints are soft constraints, not hard constraints. The errors in meeting the constraints are just minimized, along with the residuals, and they are all weighted equally. If you want hard constraints you need to weight them very heavily. Also, if you are minimizing a vector of residuals make sure the minerr algorithm is set to Levenberg-Marquardt.

RichardJ
19-Tanzanite
(To:ptc-4699986)

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

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?

RichardJ
19-Tanzanite
(To:ptc-4699986)

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.

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?

RichardJ
19-Tanzanite
(To:ptc-4699986)

You haven't weighted it. Try

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

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

RichardJ
19-Tanzanite
(To:ptc-4699986)

Sorry, but if you impose that costraint, that's what you get. Maybe you can get a different result by changing the starting guesses. Or, impose more constraints to stop it doing whatever it is you don't like.

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?

Top Tags