Fzero function error in MATLAB. Need inputs regarding the ways to combat the error
I can’t seem to rectify this error at all.Can anyone let me know how to deal with this error? I always clear all and clc at the beginning of the code so I don’t think there’s a variable remaining in the workspace
Error using fzero>localFirstFcnEvalError
FZERO cannot continue because user-supplied function_handle ==>
@(c_H) closedsys(c_H,Q_rest_Na_Cl(b),v_W,k_1,k_2,ksp_CACO3,k_H,k_W,N_totCa,N_totC,v_G,T)
failed with the error below.
Array indices must be positive integers or logical values.
Error in fzero (line 295)
localFirstFcnEvalError(FunFcn,FunFcnIn,ME);
Error in line 37
c_H_zero = abs(fzero(closesys_func, c_H))
Given below is the line 295 that is in the MATLAB logs
% Put first feval in try catch
try
fx = FunFcn(x,varargin{:});
catch ME
localFirstFcnEvalError(FunFcn,FunFcnIn,ME);
endI can’t seem to rectify this error at all.Can anyone let me know how to deal with this error? I always clear all and clc at the beginning of the code so I don’t think there’s a variable remaining in the workspace
Error using fzero>localFirstFcnEvalError
FZERO cannot continue because user-supplied function_handle ==>
@(c_H) closedsys(c_H,Q_rest_Na_Cl(b),v_W,k_1,k_2,ksp_CACO3,k_H,k_W,N_totCa,N_totC,v_G,T)
failed with the error below.
Array indices must be positive integers or logical values.
Error in fzero (line 295)
localFirstFcnEvalError(FunFcn,FunFcnIn,ME);
Error in line 37
c_H_zero = abs(fzero(closesys_func, c_H))
Given below is the line 295 that is in the MATLAB logs
% Put first feval in try catch
try
fx = FunFcn(x,varargin{:});
catch ME
localFirstFcnEvalError(FunFcn,FunFcnIn,ME);
end I can’t seem to rectify this error at all.Can anyone let me know how to deal with this error? I always clear all and clc at the beginning of the code so I don’t think there’s a variable remaining in the workspace
Error using fzero>localFirstFcnEvalError
FZERO cannot continue because user-supplied function_handle ==>
@(c_H) closedsys(c_H,Q_rest_Na_Cl(b),v_W,k_1,k_2,ksp_CACO3,k_H,k_W,N_totCa,N_totC,v_G,T)
failed with the error below.
Array indices must be positive integers or logical values.
Error in fzero (line 295)
localFirstFcnEvalError(FunFcn,FunFcnIn,ME);
Error in line 37
c_H_zero = abs(fzero(closesys_func, c_H))
Given below is the line 295 that is in the MATLAB logs
% Put first feval in try catch
try
fx = FunFcn(x,varargin{:});
catch ME
localFirstFcnEvalError(FunFcn,FunFcnIn,ME);
end fzero, function MATLAB Answers — New Questions