Borrar filtros
Borrar filtros

How can I check the parameters at each iteration in fminsearch

6 visualizaciones (últimos 30 días)
Saeid Bina
Saeid Bina el 8 de Nov. de 2019
Comentada: Saeid Bina el 8 de Nov. de 2019
Hello everyone. I am very new in Matlab. I prepared a code that finds the minimum of RMSE to fit a data.
I have one function and also m file that calls function file. And easily trys to find the minimum. Please help me to prepare output file or change the option of fminsearch.
In order to save your time, I have copied my file here:
Thank you so much in advance.
Function File:
function [RMSE,Tfm_ILS] = Tfm_ILS(par,tau,Tfm_mis)
% Detailed explanation goes here
T_0 = 15.96; % undisturbed ground temperature [°C]
C_0 = 4900000;
r_bh = 0.076; % borehole radius [m]
a = par(1)/C_0; % 1st try thermal diffusivity [m2/s]
q = 110.22;
Tfm_ILS = T_0 + (q*par(2))+(q/(4*pi*par(1)))*(-0.5772 + log((4*a*tau)/(r_bh^2)));
RMSE=(sum((Tfm_ILS-Tfm_mis).^2)/length(tau))^0.5;
end
------------------------------------------------
M file is here:
load GHE1_6kW_P12_V1.txt
[min,n]=size(GHE1_6kW_P12_V1);
t_in=60;
t_end=1800;
tau = GHE1_6kW_P12_V1(t_in:t_end,1);
Tfm_mis = GHE1_6kW_P12_V1(t_in:t_end,2);
par = [8.7083, 0.0699];
options= optimset('OutputFcn', @outfun);
[RMSE,Tfm_ILS] = Tfm_ILS(par,tau,Tfm_mis);
[par,RMSE] = fminsearch('Tfm_ILS',par,options,tau,Tfm_mis);
  6 comentarios
Saeid Bina
Saeid Bina el 8 de Nov. de 2019
oh! Thank you so much for your great help!
I got them. Although they are a bit confusing but still good progress!
Iteration Func-count min f(x) Procedure
0 1 0.336821
9.1437 0.0699
8.7083 0.0734
1 3 0.336821 initial simplex
9.1437 0.0664
9.3614 0.0629
A little bit difficult to undrestand or export to Excel.
Thank you so much.
Saeid Bina
Saeid Bina el 8 de Nov. de 2019
Above is just part of the iterations, I have coppied.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by