필터 지우기
필터 지우기

First input argument must be a function handle.

조회 수: 1 (최근 30일)
Sergio Manzetti
Sergio Manzetti 2017년 8월 10일
댓글: Sergio Manzetti 2017년 8월 10일
Hi, I am trying to integrate using the following function:
if true
syms h g x pi
h = 2.0545
g = 5.3442
C = 1
y = C - (exp(-2.*g.*i.*x./h)).*(C - cos(x).*((h.^2)./2) + (g.*x)/2.*h.*i)
yx = integral(y,-pi,pi)
end
however, I get the error "First input argument must be a function handle. "
Can anyone suggest a solution?
Thanks!

채택된 답변

KSSV
KSSV 2017년 8월 10일
h = 2.0545 ;
g = 5.3442 ;
C = 1 ;
y = @(x) C - (exp(-2.*g.*1i.*x./h)).*(C - cos(x).*((h.^2)./2) + (g.*x)/2.*h.*1i) ;
yx = integral(y,-pi,pi)
  댓글 수: 3
José-Luis
José-Luis 2017년 8월 10일
y = @(x) ((C - (exp(-2.*g.*i.*x./h)).*C) * ((C - (exp(-2.*g.*-i.*x./h)).*C);
In your anonymous function the @(x) is not the symbolic variable x.
Sergio Manzetti
Sergio Manzetti 2017년 8월 10일
Thanks. It must have function and not a result or call to another function in other words..?

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by