Help: Using fminsearch to calculate fractional derivatives

2 views (last 30 days)
Hi everyone,
I have been trying to incorporate caputo derivatives into my equation to calculate the optimal fractional derivatives and coefficients for the corresponding variables. I am using MATLAB'S inbuilt function fminsearch by minisizing the MSE to get the answer. However, my code isnt running when I tried to implement them on MATLAB. Can I get some enlightenment on how should I edit these code? (I have the caputo functions running perfectly with 5 parameters dy=caputo(y,t,alfa,y0,L), where
% y - the samples or function handle of the original function
% t - the time vector
% alpha - the fractional order
% y0 - the initial vector of signal and its integer-order derivatives
% L0 - the interpolation length
% dy - the Caputo derivative)
% Original Equation: Y=c(1)*X1+c(2)*X2+c(3)*X3+c(4)*x4+c(5)*X5+c(6)*X6+c(7)*X7+c(8)*X8+c(9)*X9
% Variable Matrix:
Y=GDP*10^11;
Y = Y(:);
X = [caputo(X1,t,c(10),91500, 1:53) caputo(X2/100*X1,t,c(11),2507100, 1:53) caputo(X3,t,c(12),8857716, 1:53) caputo(X4,t,c(13),1.4, 1:53) caputo(X5*10^9,t,c(14),7.49*10^9, 1:53) caputo(X6*10^9,t,c(15),5.18*10^9, 1:53) caputo(X7*10^9,t,c(16),3.32*10^9, 1:53) caputo(X8*10^10,t,c(17),1.88*10^10, 1:53) caputo(X5*10^9,t,c(18),7.49*10^9, 1:53)];
X = [caputo(X1,t,c(10),91500, 1:53)(:) caputo(X2/100*X1,t,c(11),2507100, 1:53)(:) caputo(X3,t,c(12),8857716, 1:53)(:) caputo(X4,t,c(13),1.4, 1:53)(:) caputo(X5*10^9,t,c(14),7.49*10^9, 1:53)(:) caputo(X6*10^9,t,c(15),5.18*10^9, 1:53)(:) caputo(X7*10^9,t,c(16),3.32*10^9, 1:53)(:) caputo(X8*10^10,t,c(17),1.88*10^10, 1:53)(:) caputo(X5*10^9,t,c(18),7.49*10^9, 1:53)(:)];
% Parameters: c1=c(1) c2=c(2) c3=c(3) cn=c(n) where n=[1,18]
Yfcn=@(c,X) X(:,1).*c(1)+X(:,2).*c(2)+X(:,3).*c(3)+X(:,4).*c(4)+X(:,5).*c(5)+X(:,6).*c(6)+X(:,7).*c(7)+X(:,8).*c(8)+X(:,9).*c(9)
SSECF=@(c) sum((Y - Yfcn(c,X)).^2)/53;
c0=-100*1e10+(2*100*1e10).*rand(1,18); % Initial Parameter Estimates (-100*10^10,100*10^10)
options = optimset('MaxFunEvals', 1E7, 'MaxIter', 1E7);
[c,SSE] = fminsearch(SSECF,c0,options);
  3 Comments
Matt J
Matt J on 7 Jun 2021
Edited: Matt J on 7 Jun 2021
@Yew Seng Tan There is a c in the lines that generates X
X = [caputo(X1,t,c(10),91500, 1:53) ...
This is not part of your objective function, even though you later use a different variable of the same name in your objective function SSECF. Where does this original c come from?
Yew Seng Tan
Yew Seng Tan on 7 Jun 2021
I'm trying to set up a fractional order derivatives for each of the variables X1-X9. c(10) to c(18) represent the order of fractional derivatives for each of the variables. I saw a paper stating that this alphas could be generated using the fminsearch function via MATLAB.

Sign in to comment.

Answers (1)

Matt J
Matt J on 7 Jun 2021
Edited: Matt J on 7 Jun 2021
Your optimization problem appears to be an unconstrained, linear least squares minimization. I don't see why you need an iterative solver at all. You could just solve with,
c=X\Y;
  8 Comments
Yew Seng Tan
Yew Seng Tan on 8 Jun 2021
Thanks for the reply! Appreciate it! I will try this out now!

Sign in to comment.

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!