Help: Difficult in optimising these ODE 45 equations

조회 수: 1 (최근 30일)
ruban ramalingam
ruban ramalingam 2019년 7월 24일
댓글: Star Strider 2019년 7월 24일
First file
function chisquare = myObjective(P)
a = P(1);
b = P(2);
c = P(3);
d = P(4);
sigma = 180;
hstress = 3463.46;
Hstar = 0.7846;
Kc = 0.1137;
tspan = 0.3722:1:10;
initial_conditions = [0;0;0;0];
[t,y] = ode45(@(t,y)pair1(t,y,a,b,d,hstress,sigma,Hstar,Kc,c),tspan,initial_conditions) %function call
pred=y(:,1);
for i=1:length(t)
expn(i) = exp(i+1)
end
plot(t,expn)
hold on
plot(t,pred)
hold off
chisquare =0;
for i=1:length(pred)
chisquare = chisquare+(pred(i)-expn(i)).^2;
end
end
Second script File
function dy=pair1(t,y,a,b,d,hstress,sigma,Hstar,kc,c)
dy=zeros(4,1);
dy(1) = a*sinh((b*(sigma^d)*(1-y(2)))/((1-y(3))*(1-y(4)))) ;
dy(2) = ((hstress*(a*sinh(b*(sigma^d)*(1-y(2)))/(1-y(3))*(1-y(4))))/(sigma^d))*(1-y(2)/Hstar);
dy(3) = (kc/3)*power((1-y(3)),4);
dy(4) = c*y(1);
end
Third script file
X=csvread('0.18_250MPa.csv');
exp=X(:,2);
P = [0.001 0.1 0.1 0.001];
op = optimiza(P)
Text file is attached below.. Please find the attachment
Ending with the error
Error using myObjective (line 2)
Not enough input arguments.
I suspect I know a bit of what's going wrong.. yet I'm at a loss for how to fix it.. Any help is much appreciated
  댓글 수: 1
Star Strider
Star Strider 2019년 7월 24일
If you are intending to fit your differential equations to data see:
There are some others as well, however these are the most illustrative.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by