Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline romanoffff  
#1 Posted : 23 March 2019 23:44:12(UTC)
romanoffff

Rank: Newbie

Groups: Registered
Joined: 23/03/2019(UTC)
Posts: 4
Russian Federation
Location: SPb

Hello everybody.
I`m trying to fit Coffin-Menson curve to data generated by Coffin-Menson equation using least squares method.
For that I use an example code from Newton.sm (18kb) downloaded 31 time(s). wth some modifications Least_squares_method.sm (48kb) downloaded 25 time(s)., but code tells me,
that something is going wrong and I can`t find out the reason.
I will be appriciated, if someone is able to explain it.
Thank you in advance.

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 24 March 2019 04:36:09(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: romanoffff Go to Quoted Post
Hello everybody.
I`m trying to fit Coffin-Menson curve to data generated by Coffin-Menson equation

... you must have data set to fit a model function .
Your data set is experimental, post it as raw as possible.
Easy to experiment a fit.
Hopefully the data set is not too long. If it has to be created
it takes about ½ a day to create a 700 data set. Just a job
like any other from *.PDF or else source.

Welcome ... cheers, Jean

Please, come back.

Offline Razonar  
#3 Posted : 24 March 2019 05:29:02(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi Romanoff. Your setup it's basically correct, and I guess that it theoretically must to work, with the only addition of Clear(i) in the body of the target function. But that's only in theory. Problem here is that the Jacobian require the evaluation for a symbolic derivatives for a target function with 104 elements for each sum by four rows with four variables. Even maybe SMath could get some result for that, you also must to invert that Jacobian, which I guess that it can't be done for some reasonable time.

In the attached you found a pure numerical Jacobian and it's inversion. In green a couple of notes. Theoretically, it's works. But again, just theory. In the practice I don't understand the construction of your target function. In the second attached, a simplification for the setup. Your start point seems to be the actual solution.

Hope that this notes helps.

Least_squares_method.sm (53kb) downloaded 25 time(s).
Least_squares_method revised.sm (36kb) downloaded 36 time(s).

Best regards.
Alvaro.
Offline Jean Giraud  
#4 Posted : 24 March 2019 15:05:32(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: romanoffff Go to Quoted Post
I`m trying to fit Coffin-Menson curve to data generated by Coffin-Menson equation using least squares method.

LS [least Squares], that's all what it is: Cholesky solver.
It is the core algorithm of the CG [Conjugate Gradient],
which CG is more powerful to fit model function.
Lot many fit techniques and methods in Smath.
Only experimental data are needed, model function if available.

Jean

Cholesky.PNG

PolyFit QUICK_Scale.sm (54kb) downloaded 19 time(s).
Offline Jean Giraud  
#5 Posted : 24 March 2019 16:24:10(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Just an exercise, it suggest a model fit rather polyfit.

Romanoffff.sm (66kb) downloaded 16 time(s).
Offline Jean Giraud  
#6 Posted : 24 March 2019 16:55:43(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
Just an exercise, it suggests a model fit rather than polyfit.

... slightly better fit. My point is: NO experimental data => NO fit !

Romanoffff[1].sm (58kb) downloaded 22 time(s).
Offline romanoffff  
#7 Posted : 24 March 2019 21:34:15(UTC)
romanoffff

Rank: Newbie

Groups: Registered
Joined: 23/03/2019(UTC)
Posts: 4
Russian Federation
Location: SPb

Thank you very much for your answers, any way, I need to think a little about ways you`ve proposed. It looks, like my problem is partly solved, but stability of the convergence is the issue. When I slightly change parameters of the model, even 1000 iterations is not enough. And another one thing, when you look at b derivative, evaluated by Smath it looks fine, but c derivatve despite of the same function structure looks absolutely different.
To make a script, which works, I`ve chose the simplest way, I tried to fit function to points with known function used to get them.
Offline Jean Giraud  
#8 Posted : 24 March 2019 23:13:11(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: romanoffff Go to Quoted Post
Thank you very much for your answers, any way, I need to think a little about ways you`ve proposed.

I just introduced you to a fitting example.
You fit to experimental data ... raw data.
Trust the old man that has fitted 100's data sets.
many of them never done by NIST...
Just raw data, something will result.
You confuse yourself from literature that does not fit data.
Engineering and literature don't go together.
Offline romanoffff  
#9 Posted : 03 April 2019 08:47:21(UTC)
romanoffff

Rank: Newbie

Groups: Registered
Joined: 23/03/2019(UTC)
Posts: 4
Russian Federation
Location: SPb

So, I`ve tried to adopt Smath file Jean Giraud showed, but have some issues.I`m truing to fit function f(x,Ni)Sadel(x,1)*(Ni)^el(x,2)+el(x,3)*(Ni)^el(x,4)) to experimental points: Ni:mat(729,1000,3000,10000,30000,100000,6,1) ε_res:mat(1.9996,1.6798,1.0557,0.7854,0.6741,0.6046,6,1), where Ni- number of full cycles till rupture, ε_res,- strain range. The issue is, that in your examples derivatives are functions of one variable, but in case of my one it is function of 2 variables, for example, derivative by el(x,2) is el(x,1)*(Ni)^el(x,2)*ln(Ni). Could you please give me an advise, how to fit this function, Pure Newton`s method doesn`t give me convergence.
Thank you in advance.
Offline romanoffff  
#10 Posted : 03 April 2019 09:07:01(UTC)
romanoffff

Rank: Newbie

Groups: Registered
Joined: 23/03/2019(UTC)
Posts: 4
Russian Federation
Location: SPb

It seems, that I found an example https://en.smath.com/for...-of-equation-system.aspx I`ll try to adopt it to my data.
Thanks.
Offline Jean Giraud  
#11 Posted : 03 April 2019 15:54:35(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: romanoffff Go to Quoted Post
It seems, that I found an example https://en.smath.com/for...-of-equation-system.aspx I`ll try to adopt it to my data.

If you purchase strain gauge, they come with the corresponding factor
and if applicable the reading equipment will compensate for temperature.
What I understand: you are experimenting some strain gauge material
simulating some real application. In that case, from the experimental
data as collected, you want a model function and the best representative
fit to the data. Then, only the data are needed.
If you just have a graph from the lab test, that's good enough.
Please don't be shy, Smath Community is worth a Gold Bridge
As you don't look familiar enough with fitting data, you may
obscure yourself by some examples that you will gather here/there.
Cheers ... Jean is waiting to hear more from you.

My last involvement with strain gauge was at Pratt-Whitney [1986]
designing test bench. Just purchased from Omega, plug in the
Data Logging input card.

Offline Jean Giraud  
#12 Posted : 03 April 2019 17:26:42(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
It seems, that I found an example

The example you are referring is one of the hardest in my collection.
This model is ultimately reflexive. It is not the worst, some just
can't be fitted at all ... only by hand trial/error.
On the other hand, CG [Conjugate Gradient] is robust for models
not reflexive or slightly reflexive.
Here is a refreshed version.

Cheers ... Jean

Genfit al_ nleqsolve VERY Difficult ConjugateGradient.sm (70kb) downloaded 33 time(s).

Offline Jean Giraud  
#13 Posted : 03 April 2019 18:12:46(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
If you just have a graph from the lab test, that's good enough.

No problem to fit either one in the elastic region !

StrainGauge.PNG

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.