Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hello All,
Could you please briefly explain about the constraint "weight" factor for the Minerr routine? How does it work and how it can be defiend?
Thank you.
Solved! Go to Solution.
You pass minerr a vector of residuals, which is the differences between the fitted function and the data points. For each point you have y[i-f(x[i), and for N points you therefore have N residuals. They are all equally weighted in the fit. If you add a constraint for a parameter, say p1>2, there is an error in that constraint if p1<2. That error is weighted exactly the same as each of the N residuals. Basically, you have N+1 errors in the fit and minerr will try to minimize the sum of the squares of those errors, with no particular preference given to the error in the constraint. You can change the weighting by multiplying any of the N+1 errors by some factor that either makes it larger or smaller. If you want a hard constraint you need to weight it very heavily. To do that rearrange the constraint and multiply by a very large number: (p1-2)*10^15>0.
You pass minerr a vector of residuals, which is the differences between the fitted function and the data points. For each point you have y[i-f(x[i), and for N points you therefore have N residuals. They are all equally weighted in the fit. If you add a constraint for a parameter, say p1>2, there is an error in that constraint if p1<2. That error is weighted exactly the same as each of the N residuals. Basically, you have N+1 errors in the fit and minerr will try to minimize the sum of the squares of those errors, with no particular preference given to the error in the constraint. You can change the weighting by multiplying any of the N+1 errors by some factor that either makes it larger or smaller. If you want a hard constraint you need to weight it very heavily. To do that rearrange the constraint and multiply by a very large number: (p1-2)*10^15>0.