Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Unforeseen error in running script: 'fmincon' and function evaluation. What could be wrong?

2 vues (au cours des 30 derniers jours)
Sean
Sean le 24 Fév 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
Dear readers,
I am trying to evaluate a likelihood function, but I get this unforeseen error (attachment). I still get output, but it is unclear to me what the error means and how I can resolve it.
Thank you for your time and effort.
All the best,
  5 commentaires
Rik
Rik le 24 Fév 2018
You forgot to attach the excel file. I replaced it with a 100x1 random vector, just to check the rest of the code, and for me it runs without errors.
Two other remarks: clc,clear all,close all is cargo cult programming. At the very least you should replace clear all with clear variables. It is better to separate workspaces by using functions. clear all also removes breakpoints, which are an invaluable tool of debugging.
The second remark is that Matlab has a function for infinity: inf. This didn't introduce errors for me, so if there isn't a technical reason because of your project, you shouldn't need to encode another value for infinity.

Réponses (1)

Sean
Sean le 24 Fév 2018
Thank you for the tips! Still a lot to learn. I will be home again in a few hours and try to incorporate your suggestions.

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by