I have a program using fminbnd and it works perfectly on my new version of MATLAB. Some of my colleagues have an older version 2010b and it yields and error message. Have there been any major changes to this function over the past two years?
Do you use the LargeScale algorithm ? (default case).
It was improved in 2011b:
Enhanced Robustness in Nonlinear Solvers
More solvers now attempt to recover from errors in the evaluation of
objective functions and nonlinear constraint functions during
iteration steps, or, for some algorithms, during gradient estimation.
The errors include results that are NaN or Inf for all solvers, or
complex for fmincon and fminunc. If there is such an error, the
algorithms attempt to take different steps. The following solvers are enhanced:
[...]
fminunc LargeScale algorithm
[...]
See release notes
Related
I'm using the MATLAB's function 'pdepe' to solve a problem with some partial differential equations, a parabolic one.
I need to know the kind of numerical method that function uses, 'cause I have to notify this in a report.
The description of the function in MathWorks is "Solve initial-boundary value problems for systems of parabolic and elliptic PDEs in one space variable and time". Is it a finite difference method?
Thanks for helping me.
Taken from the Matlab 2016b documentation for pdepe:
The time integration is done with ode15s. pdepe exploits the
capabilities of ode15s for solving the differential-algebraic
equations that arise when Equation 1-3 contains elliptic equations,
and for handling Jacobians with a specified sparsity pattern.
Also, from the ode15s documentation:
ode15s is a variable-step, variable-order (VSVO) solver based on the
numerical differentiation formulas (NDFs) of orders 1 to 5.
Optionally, it can use the backward differentiation formulas (BDFs,
also known as Gear's method) that are usually less efficient
As indicated by Alessandro Trigilio, ode15s is used to advance the solution forward in time. Exactly what the function is advancing in time is a semi-discrete, second-order Galerkin formulation for non-singular problems or a semi-discrete, second-order Petrov-Galerkin formulation for singular problems (polar or spherical meshes that include the origin). As such, the spatial discretization is finite element in nature.
I know that fitcsvm is a new command in matlab new version and in the latest document say that svmtrain will be removed. Are the two commands the same? Actually I notice that they are different in result in my recent work. Can anyone help me with this strange problem?
According to my experiments, I found that the two functions are different. fitcsvm takes the empirical distribution into consideration, the distribution is related to the number of positive samples and negatives in the default situation. However, svmtrain just take this distribution as [0.5 0.5], and one can think there's no prior knowledge.
Further, it may be with the data whether they have been standardization, to get more about this, just find the related document about SVM.
from fitcsvm:
fitcsvm and svmtrain use, among other algorithms, SMO for optimization. The software implements SMO differently between the two functions, but numerical studies show that there is sensible agreement in the results.
from Wikipedia Sequential minimal optimization:
SMO is an iterative algorithm for solving the optimization problem ...
I was using Matlab's fmincon but the optimization stopped with the following message
fmincon stopped because the size of the current step is less than
the selected value of the step size tolerance.
I have TolX set to 10^-10 and Tolfun to 10^-10 as well
I checked the logs and the first-order optimality was 198. Therefore this is definitely not the optimum solution. What could possibly go wrong?
Further, I used different version of matlab R2013b and R2014a and for the same code and data, they have different results. Is there something wrong with fmincon in matlab R2013b?
When you have a question about the difference between two versions of Matlab or, as in this case, two toolbox versions, the first place to check is release notes: for Matlab and for the Optimization toolbox. Indeed, it seems that fmincon was updated. Do you specify an 'Algorithm'? If not, the difference may be due the different default in R2014a. In this case, you may be able to specify the use of the 'interior-point' algorithm in R2013b and get better results.
You can read about the algorithms used by fmincon here.
I have been trying to model the Fabry-Perot resonator in simulink. I am not sure if it is right to choose simulink for this task but I have been getting some results, at least. However, I have been also getting an error of algebraic loop when I use a different pair of coupling/reflection parameters. It says,
"Simulink cannot solve the algebraic loop containing
'jblock_multi_MR/Meander2b/Subsystem3/Real-Imag to Complex' at time
6.91999999999991 using the LineSearch-based algorithm due to one of the
following reasons: the model is ill-defined i.e., the system equations do
not have a solution; or the nonlinear equation solver failed to converge
due to numerical issues.
To rule out solver convergence as the cause of this error, either
a) switch to TrustRegion-based algorithm using
set_param('jblock_multi_MR','AlgebraicLoopSolver','TrustRegion')
b) reducing the VariableStepDiscrete solver RelTol parameter so that
the solver takes smaller time steps.
If the error persists in spite of the above changes, then the model is
likely ill-defined and requires modification."
Changing the solver does not help. As a note, I implemented the system in terms of electric fields and complex signals naturally.
thanks for any help.
There is no magic solution for solving algebraic loop issues, as these issues tend to be very model-dependent. Here are a few pointers though:
What are algebraic loops in Simulink and how do I solve them?
How can I resolve algebraic loops in my Simulink model in Simulink 6.5 (R2006b)?
Algebraic Loops in the Simulink documentation
See also this answer to a similar question on SO, with some suggestions for breaking the loop.
I have an fsolve in an m file and it works perfectly in version 2011b. However, the fsolve fails each time in 2012a. Has there been a major change to eithre the function or the options that would cause this?
Here is what R2012a Release Notice saying about fsolve:
Levenberg-Marquardt Algorithm Tweak
The fsolve, lsqcurvefit, and lsqnonlin solvers no longer use the
magnitude of the Levenberg-Marquardt regularization parameter as a
stopping criterion, so they no longer return an exit flag of -3 when
using the levenberg-marquardt algorithm. Instead, they use the TolX
tolerance in all internal calculations.
http://www.mathworks.com/help/toolbox/optim/rn/bs86_xz.html#btd80ns
You might want to compare it from the documentation of the current release and the older releases.