Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • Visual Paradigm
  • IBM
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • Visual Paradigm
  • IBM
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/Non linear fitting and parametric optimization with genetic algorithm

Non linear fitting and parametric optimization with genetic algorithm

PuTI / 2025-01-31
Non linear fitting and parametric optimization with genetic algorithm
Matlab News

I have a constitutive model with 4 parameters to fit to experimental stress vs strain data. Before implementing the GA, I tried lsqnonlin (with and without multistart), but one of the main problems is that the algorithm often tends to assign bound values to the optimised parameters. To the first parameter, which is larger than the others, it assigns the upper bound, to the second and third it assigns the lower bounds. Plotting the best individuals over time, it appears that the ga spans little between the solutions, and the optimisation seems to be biased towards the first parameter.
I am using the uniaxial model proposed by Dong, and have rechecked the correctness of the model form several times. Below is the main containing the ga and my error function. Any help is welcome, thank you

%CHANGE LINE 3 TO SELECT THE PATCH
%CHANGE LINES 9 AND 10 TO SELECT THE SPECIMEN
clc; clear all;close all;
load ("data_11122.mat"); % change lot number if necessary
clearvars -except data

%Model requires lambda= x/x0 instead of epsilon: calculate lambda
% from exp data and store in data struct

stress=data(6).stress; %change index to change dogbone if necessary
stress=stress/max(stress);
strain=data(6).strain; %change index to change dogbone if necessary
p_initial=[50 25 5 .5]*10e-3;
a0=[1 0 0];
%vincoli su zeta imposti da dong ( zeta tra 0 e 1 )
lb=[0 0 0 0]; %% AGGIUSTA UNITA DIN MISURA
ub=[650 98 35 1];

%ottimizzazione non lineare con metodo least square ( like Dong )
options = optimoptions(‘ga’, ‘Display’, ‘iter’, ‘PopulationSize’, 100, ‘MaxGenerations’, 200, ‘UseParallel’, true,’NonlinearConstraintAlgorithm’,’penalty’,’PlotFcn’,’gaplotbestindiv’,’InitialPopulationMatrix’,p_initial);
nvars=4;
[p_opt, fval, exitflag, output] = ga(@(p)(error_function(p, strain, stress)), nvars, [], [], [], [], lb, ub, [], options);

%check plot e ricostruzione del modello con i parametri ottimizzati
c = p_opt(1); % c
k1 = p_opt(2); % k1
k2 = p_opt(3); % k2
zeta = p_opt(4); % zeta
for i=1:length(strain)

sigma_calculated(i)=c*(strain(i)^2) + 2*strain(i)^2*k1*((strain(i)^2-1)*(i-zeta)^2*exp(k2*(strain(i)^2-1)^2*(1-zeta)^2));

end

% for i=1:length(strain)
% f = [strain(i) 0 0; %deformation gradient for each value of strain
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % Calcola il tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = sum(sum(C .* prodot)); % calcolo invariante di C
% I = eye(3); % Matrice identità
%
% sigma= f*c*I*f’ + 2*f*(k1 * (1 – zeta)^2 * (I4 – 1) * (exp(k2 * ((1 – zeta) * (I4 – 1))^2)) * prodot)*f’;
%
% sigma_calculated(i)= sigma(1,1); %componente xx
% end

figure()
plot (strain,stress);
hold on
plot(strain, sigma_calculated,’r’);
legend (‘experimental’, ‘model’,’Location’, ‘northwest’);

function error = error_function(p,strain,stress)

sigma_calculated = zeros(length(strain), 1);

for i = 2:length(strain) %avoiding first value=0;

% f = [strain(i) 0 0; %deformation gradient
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = a0′ .* C .* a0; % calcolo IV invariante di C
% I = eye(3);
%
% sigma= f*p(1)*I*f’ + 2*f*(p(2) * (1 – p(4))^2 * (I4 – 1) * (exp(p(3) * ((1 – p(4)) * (I4 – 1))^2)) * prodot)*f’;
%
%
% sigma_calculated(i)= sigma(1,1); %componente xx
sigma_calculated(i)=p(1)*(strain(i)^2) + 2*strain(i)^2*p(2)*((strain(i)^2-1)*(i-p(4))^2*exp(p(3)*(strain(i)^2-1)^2*(1-p(4))^2));

end

error= sum((sigma_calculated-stress).^2) ; %/sum(stress).^2; % Somma dei quadrati delle differenze
%aggiungere normalizzazione rispetto allo stress( guardare script marta calcolo error )
endI have a constitutive model with 4 parameters to fit to experimental stress vs strain data. Before implementing the GA, I tried lsqnonlin (with and without multistart), but one of the main problems is that the algorithm often tends to assign bound values to the optimised parameters. To the first parameter, which is larger than the others, it assigns the upper bound, to the second and third it assigns the lower bounds. Plotting the best individuals over time, it appears that the ga spans little between the solutions, and the optimisation seems to be biased towards the first parameter.
I am using the uniaxial model proposed by Dong, and have rechecked the correctness of the model form several times. Below is the main containing the ga and my error function. Any help is welcome, thank you

%CHANGE LINE 3 TO SELECT THE PATCH
%CHANGE LINES 9 AND 10 TO SELECT THE SPECIMEN
clc; clear all;close all;
load ("data_11122.mat"); % change lot number if necessary
clearvars -except data

%Model requires lambda= x/x0 instead of epsilon: calculate lambda
% from exp data and store in data struct

stress=data(6).stress; %change index to change dogbone if necessary
stress=stress/max(stress);
strain=data(6).strain; %change index to change dogbone if necessary
p_initial=[50 25 5 .5]*10e-3;
a0=[1 0 0];
%vincoli su zeta imposti da dong ( zeta tra 0 e 1 )
lb=[0 0 0 0]; %% AGGIUSTA UNITA DIN MISURA
ub=[650 98 35 1];

%ottimizzazione non lineare con metodo least square ( like Dong )
options = optimoptions(‘ga’, ‘Display’, ‘iter’, ‘PopulationSize’, 100, ‘MaxGenerations’, 200, ‘UseParallel’, true,’NonlinearConstraintAlgorithm’,’penalty’,’PlotFcn’,’gaplotbestindiv’,’InitialPopulationMatrix’,p_initial);
nvars=4;
[p_opt, fval, exitflag, output] = ga(@(p)(error_function(p, strain, stress)), nvars, [], [], [], [], lb, ub, [], options);

%check plot e ricostruzione del modello con i parametri ottimizzati
c = p_opt(1); % c
k1 = p_opt(2); % k1
k2 = p_opt(3); % k2
zeta = p_opt(4); % zeta
for i=1:length(strain)

sigma_calculated(i)=c*(strain(i)^2) + 2*strain(i)^2*k1*((strain(i)^2-1)*(i-zeta)^2*exp(k2*(strain(i)^2-1)^2*(1-zeta)^2));

end

% for i=1:length(strain)
% f = [strain(i) 0 0; %deformation gradient for each value of strain
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % Calcola il tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = sum(sum(C .* prodot)); % calcolo invariante di C
% I = eye(3); % Matrice identità
%
% sigma= f*c*I*f’ + 2*f*(k1 * (1 – zeta)^2 * (I4 – 1) * (exp(k2 * ((1 – zeta) * (I4 – 1))^2)) * prodot)*f’;
%
% sigma_calculated(i)= sigma(1,1); %componente xx
% end

figure()
plot (strain,stress);
hold on
plot(strain, sigma_calculated,’r’);
legend (‘experimental’, ‘model’,’Location’, ‘northwest’);

function error = error_function(p,strain,stress)

sigma_calculated = zeros(length(strain), 1);

for i = 2:length(strain) %avoiding first value=0;

% f = [strain(i) 0 0; %deformation gradient
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = a0′ .* C .* a0; % calcolo IV invariante di C
% I = eye(3);
%
% sigma= f*p(1)*I*f’ + 2*f*(p(2) * (1 – p(4))^2 * (I4 – 1) * (exp(p(3) * ((1 – p(4)) * (I4 – 1))^2)) * prodot)*f’;
%
%
% sigma_calculated(i)= sigma(1,1); %componente xx
sigma_calculated(i)=p(1)*(strain(i)^2) + 2*strain(i)^2*p(2)*((strain(i)^2-1)*(i-p(4))^2*exp(p(3)*(strain(i)^2-1)^2*(1-p(4))^2));

end

error= sum((sigma_calculated-stress).^2) ; %/sum(stress).^2; % Somma dei quadrati delle differenze
%aggiungere normalizzazione rispetto allo stress( guardare script marta calcolo error )
end I have a constitutive model with 4 parameters to fit to experimental stress vs strain data. Before implementing the GA, I tried lsqnonlin (with and without multistart), but one of the main problems is that the algorithm often tends to assign bound values to the optimised parameters. To the first parameter, which is larger than the others, it assigns the upper bound, to the second and third it assigns the lower bounds. Plotting the best individuals over time, it appears that the ga spans little between the solutions, and the optimisation seems to be biased towards the first parameter.
I am using the uniaxial model proposed by Dong, and have rechecked the correctness of the model form several times. Below is the main containing the ga and my error function. Any help is welcome, thank you

%CHANGE LINE 3 TO SELECT THE PATCH
%CHANGE LINES 9 AND 10 TO SELECT THE SPECIMEN
clc; clear all;close all;
load ("data_11122.mat"); % change lot number if necessary
clearvars -except data

%Model requires lambda= x/x0 instead of epsilon: calculate lambda
% from exp data and store in data struct

stress=data(6).stress; %change index to change dogbone if necessary
stress=stress/max(stress);
strain=data(6).strain; %change index to change dogbone if necessary
p_initial=[50 25 5 .5]*10e-3;
a0=[1 0 0];
%vincoli su zeta imposti da dong ( zeta tra 0 e 1 )
lb=[0 0 0 0]; %% AGGIUSTA UNITA DIN MISURA
ub=[650 98 35 1];

%ottimizzazione non lineare con metodo least square ( like Dong )
options = optimoptions(‘ga’, ‘Display’, ‘iter’, ‘PopulationSize’, 100, ‘MaxGenerations’, 200, ‘UseParallel’, true,’NonlinearConstraintAlgorithm’,’penalty’,’PlotFcn’,’gaplotbestindiv’,’InitialPopulationMatrix’,p_initial);
nvars=4;
[p_opt, fval, exitflag, output] = ga(@(p)(error_function(p, strain, stress)), nvars, [], [], [], [], lb, ub, [], options);

%check plot e ricostruzione del modello con i parametri ottimizzati
c = p_opt(1); % c
k1 = p_opt(2); % k1
k2 = p_opt(3); % k2
zeta = p_opt(4); % zeta
for i=1:length(strain)

sigma_calculated(i)=c*(strain(i)^2) + 2*strain(i)^2*k1*((strain(i)^2-1)*(i-zeta)^2*exp(k2*(strain(i)^2-1)^2*(1-zeta)^2));

end

% for i=1:length(strain)
% f = [strain(i) 0 0; %deformation gradient for each value of strain
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % Calcola il tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = sum(sum(C .* prodot)); % calcolo invariante di C
% I = eye(3); % Matrice identità
%
% sigma= f*c*I*f’ + 2*f*(k1 * (1 – zeta)^2 * (I4 – 1) * (exp(k2 * ((1 – zeta) * (I4 – 1))^2)) * prodot)*f’;
%
% sigma_calculated(i)= sigma(1,1); %componente xx
% end

figure()
plot (strain,stress);
hold on
plot(strain, sigma_calculated,’r’);
legend (‘experimental’, ‘model’,’Location’, ‘northwest’);

function error = error_function(p,strain,stress)

sigma_calculated = zeros(length(strain), 1);

for i = 2:length(strain) %avoiding first value=0;

% f = [strain(i) 0 0; %deformation gradient
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = a0′ .* C .* a0; % calcolo IV invariante di C
% I = eye(3);
%
% sigma= f*p(1)*I*f’ + 2*f*(p(2) * (1 – p(4))^2 * (I4 – 1) * (exp(p(3) * ((1 – p(4)) * (I4 – 1))^2)) * prodot)*f’;
%
%
% sigma_calculated(i)= sigma(1,1); %componente xx
sigma_calculated(i)=p(1)*(strain(i)^2) + 2*strain(i)^2*p(2)*((strain(i)^2-1)*(i-p(4))^2*exp(p(3)*(strain(i)^2-1)^2*(1-p(4))^2));

end

error= sum((sigma_calculated-stress).^2) ; %/sum(stress).^2; % Somma dei quadrati delle differenze
%aggiungere normalizzazione rispetto allo stress( guardare script marta calcolo error )
end ga, optimization, nonlinear, curve fitting MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

External Mode Connection Issue with C2000 LaunchPad and Speedgoat System
2025-05-17

External Mode Connection Issue with C2000 LaunchPad and Speedgoat System

how to validate mscohere?
2025-05-17

how to validate mscohere?

Transfer history to MATLAB 2025a
2025-05-17

Transfer history to MATLAB 2025a

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss