Integration doesnt work, ndefined function or method 'integral' for input arguments of type 'function_handle'.

조회 수: 3 (최근 30일)
Hi to all, I have to solve the following optimization:
theta_cal_const = fmincon(distance , theta0 , [] , [] , [] , [] , lb , ub ,[] ,
options );
with:
distance = @(theta) integral(@(u) integrand(u ,theta),-K, -gap_halfwidth )+ integral(@(u) integrand(u , theta ), gap_halfwidth , K) ;
as a result, matlab returns me the error:
undefined function or method 'integral' for input arguments of type'function_handle'.
Error in ==> fmincon at 517
initVals.f = funfcn{3}(X,varargin{:});
Error in ==> maxLH at 32
theta_cal_const = fmincon(distance , theta0 , [] , [] , [] , [] , lb , ub ,[] ,
options );
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot
continue.
this is the first time i use fmincon, i dont really understant the error message. Thank you for help
  댓글 수: 5
Star Strider
Star Strider 2015년 3월 24일
What do you get when you copy, paste, and run these lines in the Command Window:
a = whos('integral')
b = which('integral')
You should get only:
a =
0x1 struct array with fields:
name
... etc.
b =
C:\Program Files\MATLAB\R2015a\toolbox\matlab\funfun\integral.m
Dam
Dam 2015년 3월 24일
I get a =
0x1 struct array with fields: name size bytes class global sparse complex nesting persistent
b =
''

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2015년 3월 24일
The integral function has been a core MATLAB function since R2012a, so if you have that version or later, you should have it. If your version is earlier than that, use quad or one of its friends instead of integral. (The online documentation is currently for R2015a.)
If you have R2012a or later, you may have a toolbox path problem. See if running these from the Command Window solves it:
restoredefaultpath
rehash toolboxcache

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle Swarm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by