fminsearch, Not enough input arguments.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Below is my code to estimate the parms1 and parms2.
Anyone can give me some helps?
Thanks!
function rresult = calibgrain(DBn_2,dateob,Tb)
dss = linspace(0.01,3,100);
ggf = linspace(0.5,5,100);
rresult = [];
for ii = 1:length(dss)
for jj = 1:length(ggf)
dsnowi = dss(ii);grfactor = ggf(jj);
startparms = [dsnowi grfactor];
%rosen = @RMSE1 RMSE1(startparms);
%fminsearch(@(prms) BER_optimise(prms(1), prms(2)),x0)
bestparms = fminsearch(@(parms) RMSE1(parms), startparms);
%bestparms = fminsearch(@RMSE1,RMSE1(startparms)); %fminsearchbnd(@(x) f(x,c),[0.3;1], [0 0],[5 5])
dsnowi = bestparms(1);
grfactor = bestparms(2);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
rmsecomp = calcrmse(YEH,dateob,Tb);
rresult = [rresult ;dsnowi grfactor rmsecomp];
end % end of jj loop
end % end of ii loop
function thisrmse = RMSE1(parms)
% nest this function inside calibgrain so that it has
% access to all of calibgrain's variables.
dsnowi = parms(1);
grfactor = parms(2);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
thisrmse = calcrmse(YEH,dateob,Tb);
end % end of function RMSE1
end % end of function calibgrain
0 Kommentare
Antworten (2)
Alan Weiss
am 30 Dez. 2020
Next time please give the entire error message by copying and pasting everything in red:
Not enough input arguments.
Error in calibgrain/RMSE1 (line 30)
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH,
YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
Error in calibgrain>@(parms)RMSE1(parms) (line 14)
bestparms = fminsearch(@(parms) RMSE1(parms), startparms);
Error in fminsearch (line 201)
fv(:,1) = funfcn(x,varargin{:});
Error in calibgrain (line 14)
bestparms = fminsearch(@(parms) RMSE1(parms), startparms);
The error is in the msnow function, not in how you are calling fminsearch.
Alan Weiss
MATLAB mathematical toolbox documentation
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!