Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Oct 15, 2022
07:31 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 15, 2022
07:31 PM

Minerr data fitting problem

Dear colleagues,

Mathcad 3, Windows 10.

I resolve the system of equations. I defined the function named "Pt(I,I2,...,Cbb)" which consist solution (''n'', and ''p") of these equations.

In the next solve block, I try to fit experimental data - two rows - N33, P33 (where I1 is X). But unfortunately, minerre algorithm does not work giving me the error. The program is a bit busy, but the main problem is only in the last solving block. Probably someone could identify a problem in the syntaxis of the last solving block which tries to fit data by function "Pt" and parameters "Nt" and "Et". Probably the problem is that "N" and "Et" are vectors.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Oct 17, 2022
05:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 17, 2022
05:03 AM

Could it be that you are looking for something like this:

I wouldn't call it a perfect fit, but ...

You get a better fit by doing the calculation for N22 and P33 singly, but of course the values for Nt, Et, etc. you get are different.

and

I am not sure if your Prime3 will be able to open the attached worksheet - you'll have to give it a try.

5 REPLIES 5

Oct 15, 2022
10:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 15, 2022
10:41 PM

The problem is the last but one solve block which you turned into function Pt(...). This function finally throws that error as of matrix dimension mismatch,

Just try to evaluate the left hand side of the first equation (which you demand to be zero) in that solve block. You will get a nested 5 x 1 matrix with 51 x 1 vectors nested into it. You may have expected the expression to evaluate to a single normal 51x1 vector and not five of them (or did you expect a single scalar?).

I didn't look further because when I open your sheet its quite a mess with regions overlapping each other, different sized expressions and its far to wide for my equipment, would force me to scroll horizontally back and forth quite a lot. Some quirks may be due to the fact that I open your P3 worksheet with P6.

But pointing you to the vital expression should enable you to find the culprit, I hope.

Here are some of the expressions you use in this equation which I evaluated (inside the solve block so its using the guess values). You have to decide which functions return results not expected and fix 'em:

Oct 16, 2022
07:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 16, 2022
07:09 AM

Dear Werner,

Thank you for your very fast response as always. Following your recommendation, I now consider all variables scalar.

Indeed, the second solving block started to work. But unfortunately, for some reason, it does not fit the data. To fit two data sets I multiply them.

Oct 16, 2022
02:03 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 16, 2022
02:03 PM

Your solve bock with minerr has only one constraint - two scalars should be the same. But you give Prime five Parameters to play with. I hardly can imagine that this can provide any good curve fit and you can see that Prime does not even consider it necessary to change some of the guess values at all.

Oct 17, 2022
05:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 17, 2022
05:03 AM

Could it be that you are looking for something like this:

I wouldn't call it a perfect fit, but ...

You get a better fit by doing the calculation for N22 and P33 singly, but of course the values for Nt, Et, etc. you get are different.

and

I am not sure if your Prime3 will be able to open the attached worksheet - you'll have to give it a try.

Oct 17, 2022
07:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 17, 2022
07:00 AM

Thank you so much. It works now. THe file you attached is also compatible with my version thank you.