필터 지우기
필터 지우기

How can I check the parameters at each iteration in fminsearch

조회 수: 6 (최근 30일)
Saeid Bina
Saeid Bina 2019년 11월 8일
댓글: Saeid Bina 2019년 11월 8일
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
Saeid Bina
Saeid Bina 2019년 11월 8일
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 2019년 11월 8일
Above is just part of the iterations, I have coppied.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by