To all,
Forgot how to do the following in mcad 15
I’d like to find the “best” possible (feasible) set of numbers (variables) to minimize an error. See attached
I am sure I have seen examples about similar problem but can’t find them right now. I'll start looking at setting up the problem but I thought I'll ask in the meantime
Does one have to set up a Given (Find) block with the possible equation(s)/inequation(s) or should a function be defined
Thanks
Regards
Solved! Go to Solution.
@JXBWk wrote:
Thanks. After some trial and error I was just about getting there !
I have replaced the constraint "<= MaxMass" to be =MaxMass as it make more sense to "target" a mass as well as an inertia
I haven't figure out how to put an "constraint" on a specific variable. for example I would like each ycg value to be less than 120mm or even better ycg[i <= 120mm - r[i
Forget about the range i inside of the solve block!
That additional constraint seems to be easy, even though I am not sure why Mathcad accepts a constraint formulated like this as we have a vector on the LHS and a scalar on the RHS. I would have expected an error, but obviously it works OK:
Before looking at your file:
Check the built in help, it comes with examples.
Yes, you 'll probably want to use a solve block, and the Minerr function. Or Minimize...
Success!
Luc
You calculate the sum of I.YY.CG and compare it with I.target.
Shouldn't it be the sum of I.YY.shift?.
You have only one equation and one value as a target and so many variables to play with!
Not sure if thats what you are looking for, but Mathcad finds that its only necessary to change one of those many variables (lyy.cg.5) to get a perfect result.
Thanks. Indeed copied-pasted the wrong variable
Get perfect results because the values were entered to be so - to start with
It's because I have so many variables that I am not sure how to proceed
strictly speaking if change m then the related Iyy.CG must change (if you change the mass of a cube (by changing it's dimension then its inertia changes) - this introduce an extra 3 variables but 1 thing at a time
I manged to set your kindly provided example and will start playing with. You'll find that in your example/test, mcad does indeed seem to change only 1 of the variable
It's because I have so many variables that I am not sure how to proceed
Time to remember some basic algebra: You need as many equations as variables you're solving for, or the problem is not sufficiently constrained. If you have more equations than variables the problem is over constrained.
Yes I know that that why I am trying to work my way through the equations I think I have
If one assumes 4 cylindrical shapes of dimensions r & h, of possible positions ycg then there are 12 variables.
I have 4 equations for the masses, 4 for the inertia (8-off total) and only 1 extra one for the overall inertia
I therefore have to add constraints to some variables. Maybe by forcing some masses or CGs to be equal
Mathcad only changes one variable because that's all it takes to satisfy that one equation.
Sure you could add constraints like
or all I.yy.cg should be smaller than a specific value
But if, as you wrote, your variables are dependent on each other, you have to formulate those dependencies using function.
If I.yy.cg depends on m, then you have to formulate I.yy.cg as a function of m, for example.
Thanks
if functions are defined for mass & inertia how does one then uses these functions in the Given block?
See attached. Looks like the variables are not properly defined as I get an "not defined"
You can't use a range variable (i) in the solve block
You use the function INSTEAD of the variable - write fn_mass(r,h) instead of mass.
If you introduce a new variable "mass", you would also have to solve for it!
But as I see it you still have just one equation but 12 variables to play with. Thats the reason that in the solution so many values are approx. equal:
Thanks. After some trial and error I was just about getting there !
I have replaced the constraint "<= MaxMass" to be =MaxMass as it make more sense to "target" a mass as well as an inertia
I haven't figure out how to put an "constraint" on a specific variable. for example I would like each ycg value to be less than 120mm or even better ycg[i <= 120mm - r[i
@JXBWk wrote:
Thanks. After some trial and error I was just about getting there !
I have replaced the constraint "<= MaxMass" to be =MaxMass as it make more sense to "target" a mass as well as an inertia
I haven't figure out how to put an "constraint" on a specific variable. for example I would like each ycg value to be less than 120mm or even better ycg[i <= 120mm - r[i
Forget about the range i inside of the solve block!
That additional constraint seems to be easy, even though I am not sure why Mathcad accepts a constraint formulated like this as we have a vector on the LHS and a scalar on the RHS. I would have expected an error, but obviously it works OK: