Attached is a Mathcad 15 document that I have failed to troubleshoot. In sum, I am attempting to perform a convolution integral in a loop using a range variable, extracting the maximum computed value over a given time range in each cycle through the loop.
I believe the issue is an instability in Mathcad's numerical integration. As-is, the attached document runs perfectly fine, as the final output (u.max) computes without issue. However, as soon as I adjust some of the key parameters, I receive the error "This calculation does not converge to a solution" when attempting to extract the maximum values within the loop. In particular, I wish to change the t.max to 10s so that the numerical integration is done over the range 0s to 10s instead of 0s to 4s, and I wish to be able to changing the damping term (Greek "xi") to other arbitrary values and repeat; however, changing either leads to this error.
By altering the lower bound of the integrand on the "u.loop" calculation - e.g. from 0 to 0.001s - I have been able to improve the stability of the calculations slightly (that is, have been able to alter some parameters and get a solution), leading me to believe that this is where the computation error is being introduced.
However, the calculation is still fragile, and I'm at a loss of how to fix it. Does anyone have any suggestions?
Thanks,
C
Solved! Go to Solution.
I've tidied up your routines and put in some fixes that enable it to work for t=10s. You will need to check carefully that the fixes are acceptable!
Alan
I've tidied up your routines and put in some fixes that enable it to work for t=10s. You will need to check carefully that the fixes are acceptable!
Alan
Alan,
The "on error" addition to the integration was definitely the key. Thanks for the fix, and thanks, too, for taking the time to clean up the routine along the way. This was a big help!
By the way, do you happen to know why the integration errors out for certain combinations of my variables? i.e, what makes this particular calculation somewhat fragile?
Thanks again,
C
Cory Lindh wrote:
By the way, do you happen to know why the integration errors out for certain combinations of my variables? i.e, what makes this particular calculation somewhat fragile?
I'm not sure, but there's a possibility that your penultimate condition in function p(t,tm,po) is sometimes skipped.
For example, it is skipped when tm = pmax/jmax, because, in this case, the "upper" test value is actually lower than the "lower" test value!
Alan
I am coming late and my appraoch was similar to that of Alan (suppressing the time values which throws the error using onerror).
As you can see in the attached sheet with N=20, t.step=0.005 and t.end=10s there only are 91 values which throw the error, that 0.227%. That depends on the setting of TOL. Default is 10^-3. If you set it to a lower value you get errors for more time values. I guess its not advisable to set it to something higher like 10^-2 or more.
BTW, you could use the able at the end of the sheet to plot for selected time values w/o having to recalculate. If thats an option, I guess it would be better to work with the transposed table.