cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Minerr data fitting problem

amusiienko
8-Gravel

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. 

 

amusiienko_0-1665876016577.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:amusiienko)

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

Werner_E_0-1665996487894.png

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

Werner_E_1-1665996547065.png

 

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.

Werner_E_2-1665996751768.png

and

Werner_E_3-1665996940223.png

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

View solution in original post

5 REPLIES 5
Werner_E
25-Diamond I
(To:amusiienko)

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:

Werner_E_1-1665889027777.png

 

 

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.

amusiienko_0-1665918447822.png

 

 

Werner_E
25-Diamond I
(To:amusiienko)

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.

 

Werner_E
25-Diamond I
(To:amusiienko)

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

Werner_E_0-1665996487894.png

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

Werner_E_1-1665996547065.png

 

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.

Werner_E_2-1665996751768.png

and

Werner_E_3-1665996940223.png

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

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

Announcements

Top Tags