Community Tip - You can change your system assigned username to something more personal in your community settings. X
Good Morning,
I am trying to determine the exact x-location where the maximum deflection occurs. So far I have got a match function:
I wish to return the index k for which the displacement is maximum, the deflections have been calculated and stored in the vector delta-k. With the index found I can then determine the corresponding location where it is a maximum.
I know there are various topics available on this however I have not been able to get it working so far.
Thanks,
Callum
Solved! Go to Solution.
Callum,
In the Calculation tab, in the Worksheet Settings pane, change TOL to 10^-7
Or multiply your max value and entire delta vector by 10^4
The calculation was working with only one decimal place. When the default unit is meters, 1 mm is within the tolerance of 10^-3 (default setting), and it apparently ignores all of those significant figures.
You will also have to use the 0th index of the match to use it later on when referring to it in vector delta.
This solves the problem!
If you look at d, there are multiple locations with the max value:
the match function (read the help) returns a vector of the indices that match the requirement within TOL. If you take a subscript of the match function you will get a single numerical answer, but it may not be the best answer:
note the change in TOL:
Sorting thru a vector may not be the best way to find a max value or its location. Since you already have a function defined, why not find where it's slope is zero? (Red circles are Express not recognizing previous answers on recalculation.)
Hi Fred,
If you were looking for the maximum deflection at location x=? how would you go about solving. I am unsure on what the best approach would be so if there is an alternative to sorting through a vector that would be brilliant.
Thanks,
Callum
See the attached file. The first derivative of a function is the slope. When the slope is zero you're either at a maximum or a minimum.
I have no Prime 7 installed so I cannot open you file and am only using the pic you posted.
The match function always returns a vector of values and even if the result is just one index it will be a 1x1 matrix.
To get the index k you will have to write kmax:=match(.....)[0 to reference the first (and maybe only) element in the resulting vector. I am assuming that you use ORIGIN=0, otherwise you would have to change the index 0 to whatever you had chosen for ORIGIN.
The x value you are looking for should then be xmax:=xdelta[kmax
Remark "[" is the keyboard shortcut for the vector/matrix index
Another way to directly calculate the x-value could be using the lookup function -> xmax:=lookup(delta.max, delta, xdelta)
BTW, you may have your reasons doing so, but I think it would be easier to deal with the functions you seem to already have directly and don't bother working with vectors of values at all. In case of the max you would have Prime to find the zero(s) of the first derivative of the function delta.total.
Thankyou for the reply,
Suppose I have the following extract can you think of anyway to solve for when the function would be a maximum:
I wish to obtain a result that is of the form maximum deflection along the beam occurs as location x=?.
Thanks,
Callum
So my suggestion using the index on match or using the lookup function did not work OK?
Its hard to debug a picture as I not even see what the error message is telling you.
If you can post an excerpt of your sheet just using the necessary variables and not using Prime7 features like combo boxes I might be able to convert your sheet and open with my Prime 6.
Just a stab in the dark - the symbolic "solve" will not solve for variables which already have been assigned a value.
The symbolic "solve" might also fails because of the use of units sometimes.
Another reason for the solve command failing might be the way the functions delta.Q and delta.G are defined. If the are piecewise constructed (using if-statements) the symbolic solve will also fail.
Generally its better to use the numeric "root" command or a numeric solve block with "find" instead of the symbolic "solve" if you don't need a generic symbolic result but just a single value.
Callum,
In the Calculation tab, in the Worksheet Settings pane, change TOL to 10^-7
Or multiply your max value and entire delta vector by 10^4
The calculation was working with only one decimal place. When the default unit is meters, 1 mm is within the tolerance of 10^-3 (default setting), and it apparently ignores all of those significant figures.
You will also have to use the 0th index of the match to use it later on when referring to it in vector delta.
This solves the problem!
Thanks Kevin,
This seems to be working now.
Best Regards,
Callum
Thanks. I expected the sheet to contain some new P7 feature like a Combo box because the usual trick (replacing the app.xml for one of a P6 file) to "convert" it to P6 did not work. But there seems to be no such box and the Excel component should not be the cause for the conversion failing.
@LucMeekes wrote:
This should open in P6.
Luc
Thanks, yes it opens with P6.
How did you manage to convert it?
Via the same 'usual trick' that you tried, but with a little more care than just brute force.
I've extended my MathcadSheetView program with the necessary routines to do the replacement and throw out other stuff that is not supported by the previous version. What really strikes me is that this community software generally doesn't accept the resulting file, it apparently knows better what a valid Prime file is then Prime itself... I first have to open the file with the target Prime version, and save it, only then can I successfully attach it.
With P8 out now, there's some programming to be done.
Luc
Ah, I thought the Sheetview program you posted in the past would only display Mathcad 15 (and older) files.
Several ways to find the x value where f(x) is maximum:
1. When using a solve block
Sometimes I use a solve block to go from my moment equation to my deflection equation, and then it's a function rather than a vector of values.
Then you can use the root function to find the maxima
Root of the derivative works because maxima always occur where the derivative of the function is zero.
Plot them to be sure you got the right one:
2. built-in solver
Another way of finding maxima is to use the solver. Here is an example:
3. When using vector
However, you are trying to use a vector of values rather than functions. Here is how I solved the trapezoidal loading on a simply supported beam. Because trapezoidal loading is a piecemeal function, the regular integral doesn't really work. I had to use the definition of an integral to integrate discretely. The programs below use 1000 steps to integrate the moment function into the angle function and then the angle function into the deflection function.
You might find this method useful for your application.
For reference, here is the formula for trapezoidal loading on a beam. This is for a beam that can have different tributary widths on the left and right. It took me a long time to derive this.