Question: Use dsolve in a NonlinearFit

Hello,

I would like to know if it is possible to Fit data to an expression using NonlinearFit, but in this expression there is a variable that is the result of dsolve and the contains parameters I need to identify.

with(LinearAlgebra):
tensF:=Matrix([[lambdaTrig,0,0],[0,1/sqrt(lambdaTrig),0],[0,0,1/sqrt(lambdaTrig)]]):
tensdF:=diff(tensF,t):
tensFDev:=tensF-(1/3)*Trace(tensF)*Matrix(3,shape=identity):
tensB:=Multiply(tensF,Transpose(tensF)):
tensL:=Multiply(tensdF,MatrixInverse(tensF)):
tensD:=(1/2)*(tensL+Transpose(tensL)):
tensBe:=Matrix([[Be11(t),0,0],[0,1/sqrt(Be11(t)),0],[0,0,1/sqrt(Be11(t))]]):
tensdBe:=diff(tensBe,t):
tensBeDev:=tensBe-(1/3)*Trace(tensBe)*Matrix(3,shape=identity):

Above are the tensors I need in the expression.

Then there is the equation to solve. I tried something with "proc", I found on Maple Help Page.

ode:=tensdBe[1,1]=-(2/3)*tensBe[1,1]*Trace(tensD)+Multiply(tensL[1,1],tensBe[1,1])+Multiply(tensBe[1,1],Transpose(tensL[1,1]))-(2/eta)*a*Multiply(tensBeDev[1,1],tensBe[1,1]): ivp:=[ode,Be11(0)=1]: 
ode_sol:=dsolve(ivp,numeric,parameters=[a,eta]); 
ode_sol(parameters=[a=1,eta=0.1]); 
Be11Num:=proc(aValue,etaValue) global ode_sol,a,eta,t; ode_sol('parameters'=[a=aValue,eta=etaValue]); end proc;

Then I built the expression I need to fit :

tensTemp1:=2*C1*tensB+4*C2*(Trace(tensB)-3)*tensB+6*C3*(Trace(tensB)-3)*tensB-2*C4*MatrixInverse(tensB):
tensTemp1Dev:=tensTemp1-(1/3)*Trace(tensTemp1)*Matrix(3,shape=identity):
tensBe:=Matrix([[Be11Num,0,0],[0,1/sqrt(Be11Num),0],[0,0,1/sqrt(Be11Num)]]):

tensTemp2Dev:=2*G*tensBe-(1/3)*Trace(2*G*tensBe)*~Matrix(3,shape=identity):
sigma:=tensTemp1Dev+tensTemp2Dev-p*~Matrix(3,shape=identity):
p:=sigma[2,2]+p: 
sigma:=tensTemp1Dev+tensTemp2Dev-p*~Matrix(3,shape=identity): 
PK:=sigma.Transpose(MatrixInverse(tensF)):
PK:=PK[1,1]: #expression  to fit

Then I tried to fit

NonlinearFit(PK,t1Expe,PK1Expe,t,output=[parametervalues,residualsumofsquares]);

The problem is that the result is

[[Be11Num = 1.00001503587671, C1 = 0.588252936860393, C2 = 6091.63136742778, C3 = -4061.11176413018, C4 = -0.494824008942008, G = 1409.06089189383], 17.90514021]

It's computing the solution Be11 but I can't get the value of the parameters a and eta. Moreover Be11 is depending on t, so it seems I only get the last value.

What do you think, is it possible to do what I just explained ?

Thnak you in advance,

Manon

Please Wait...