cancel
Showing results for
Did you mean:
cancel
Showing results 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

6-Contributor

Minerr data fitting problem

Dear colleagues,

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.

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:amusiienko)

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
24-Ruby V
(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:

6-Contributor
(To:Werner_E)

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.

24-Ruby V
(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.

24-Ruby V
(To:amusiienko)

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.

6-Contributor
(To:Werner_E)

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

Announcements
Top Tags