Hi,
I have a problem that is sensitive to guess values. I am attempting to copy a method that was posted some time ago
https://community.ptc.com/t5/Mathcad/Solve-block-problem-3-1/td-p/43434
but I get an error as follows:
I am sure the fix is trival but I have a had no luck fixing it. Any help would be appreciated.
Thanks
Ross
Hi,
omega in your sheet is a range. Mathcad Prime 11 can now create a vector.
Program uses columns 6 and 7 that do not exist so cause errors. Changed them to 3 and 4.
Put the creation of omega and small program below not in the solve block above.
Cheers
Terry
Using the values given (1000 frequency values from 0.1 to 100 with a constant step width of 0.1) I experienced no problems when using the very same guess values (all 0.05) for all of them. Even though these guesses are way off from the actual results. usually its better to use guesses nearer to the actual expected values.
Here I create a table with values using 0.05 as guess throughout.
The table created that way is identical to the table ANS6 created by Terry. There are just tiny differences in the range of 10-20 which sure can be ignored.
See details in the attached sheet where I used Terry's sheet as a start.
This means to me that you could omit the guess values in your function f and use the same guesses (or better ones) throughout.
I did it in hat sheet and called the function f2(w).
I show how to create individual functions alpha(w), etc. and use a range for plotting.
When I was about to suggest using "logspace" instead of "vec" to create a vector of values which are equally spaced in a log-lin plot, I experienced the solve block failing.
I created a function which would trap this error
so we can see which frequencies out of the 1000 used made the solve block fail and it was found that just two frequency were problematic.
I investigated further (details see in attached sheet) and it looks that at these frequencies we have some kind of spikes (don't look like asymptotes any more but I am not sure) the solve block has troubles with.
I used the suggested mean values as guesses and not omega1 worked but omega2 still failed.
Not sure if these frequencies have a special meaning to you.
I am also not sure if the approach you found in that thread would be of help in this case. As I showed the solve block had no problems with the frequencies linear spaced from 0.1 to 100 with step width 0.1. So there was no need to awkwardly use the results of the 'previous' calculation as guesses.
I looked to the left and right of the problematic frequencies until the solve block would work and used these values as guesses in your function f.
Now both frequencies worked:
I also tried the results from frequency w1 instead of the all 0.05 and now no frequency from the vector failed, but some frequency near both(!) problematic ones did.
I am not sure which troubles you encountered and if going through all these hassles is it worth to achieve results (of doubtful accuracy) at these positions.
Maybe the error trapping function f3 already suffices for your needs?
Prime 11 sheet attached
BTW, if you set the system variable CTOL to a large value like 0.1 all frequencies in the last vector omega work Ok, but it looks like the values returned are awfully inaccurate. Setting CTOL to a smaller value than the default 0.001 may make more frequencies fail
