Effacer les filtres
Effacer les filtres

fmincon doesn't give me the same results as in the previous version !!

1 vue (au cours des 30 derniers jours)
Mary Ben
Mary Ben le 25 Oct 2013
Commenté : Mary Ben le 8 Nov 2013
Hi, please I need your help! In fact, I have just started using the version R2013a of Matlab. To my surprise fmincon doesn't give me the same results as in the previous version (that run without any problem on another Matlab version R2007b and I have had a good results). Thanks Best Regards
  17 commentaires
Walter Roberson
Walter Roberson le 26 Oct 2013
Nothing seems to be attached ?
Walter Roberson
Walter Roberson le 27 Oct 2013
The source you emailed me is not long, and could easily be posted here. However, it relies upon loading a number of data files that we do not have access to.
Also, it requires the Statistics toolbox for normcdf, as well as the Optimization toolbox for fmincon

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Nov 2013
kmeans() involves randomization. You might not be using the same random algorithm between the two versions, or you might be using different seeds.
  9 commentaires
Walter Roberson
Walter Roberson le 5 Nov 2013
You will need
dbstop if caught error
In your line
prd3=evec3(position3,1:m)*xl(1:m);
do you want matrix multiplication, , or do you want element-by-element multiplication, . ?
The error message is probably suggesting that x1 does not have at least "m" entries.
Mary Ben
Mary Ben le 5 Nov 2013
I want multiply a matrix evec3(position3,1:m) by a vector xl (1:m). such as m=10 , position3= 20.

Connectez-vous pour commenter.

Plus de réponses (4)

Mary Ben
Mary Ben le 27 Oct 2013
I created a simple example of my function. please See attached file to get information on my func.m
  29 commentaires
Matt J
Matt J le 1 Nov 2013
Well, you need to verify that. Before you blame a difference between R2008 and R2013, you need to run the exact same experiment in both.
Mary Ben
Mary Ben le 1 Nov 2013
OK, I will try to do!

Connectez-vous pour commenter.


Matt J
Matt J le 1 Nov 2013
Incidentally, alpha shapes might be a better way of extracting the lower envelope. See, for example
  2 commentaires
Mary Ben
Mary Ben le 2 Nov 2013
thank you for your help! the function you sent me it draws a curve from points but in my code I want to optimize a function f () to obtain a vector x in order to plot the lower envelop.
Matt J
Matt J le 2 Nov 2013
You should be able to obtain an envelope for the points by choosing parameters appropriately.

Connectez-vous pour commenter.


Mary Ben
Mary Ben le 5 Nov 2013
Modifié(e) : Mary Ben le 5 Nov 2013
[xl ,fval , exitflag,outputStruct]=fmincon(@func,x0,A,inB,[],[],[],[],[], options)
Caught-error breakpoint was hit in func at line 68. The error was:
Index exceeds matrix dimensions.
68 prd3=evec3(position3,1:m)*xl(1:m);
  12 commentaires
Matt J
Matt J le 5 Nov 2013
Modifié(e) : Matt J le 5 Nov 2013
If N is the number of unknown variables, you must pass fmincon an initial guess vector x0 of length N. Among other things, this is how fmincon knows how many unknowns to try to solve for.
Incidentally, it is bad practice to load fixed data to your fun.m from .mat files. See here for better ways to pass fixed known parameters to functions,
Mary Ben
Mary Ben le 5 Nov 2013
Thanks a lot for your help!

Connectez-vous pour commenter.


Mary Ben
Mary Ben le 7 Nov 2013
Modifié(e) : Mary Ben le 7 Nov 2013
I have downloaded a program written in C, and wish to run it in Matlab. To do this is use the mex to compile it into Matlab. This has worked for me with R20013a. However, I tried to use it today with R2008b and I got the error;
>> mex FiltreShenCastan.c
Error: Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.
C:\PROGRA~1\MATLAB\R2008B\BIN\MEX.PL: Error: Unable to locate compiler.
??? Error using ==> mex at 213
Unable to complete successfully.
>>
I need your help. Thanks!
  4 commentaires
Matt J
Matt J le 7 Nov 2013
Hmmm. What about what it says about SDK? Are you sure it's installed? To be certain, it might be worthwhile just reinstalling both MS Visual C++ and SDK.
In any case, if you continue to have problems, I would post it as a new question/topic. It will have better visibility to the community that way.
Mary Ben
Mary Ben le 8 Nov 2013
simply, I used the matlab R20013a!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Function Handles dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by