Filter löschen
Filter löschen

First input argument must be a function handle.

1 Ansicht (letzte 30 Tage)
Sergio Manzetti
Sergio Manzetti am 10 Aug. 2017
Kommentiert: Sergio Manzetti am 10 Aug. 2017
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!

Akzeptierte Antwort

KSSV
KSSV am 10 Aug. 2017
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 Kommentare
José-Luis
José-Luis am 10 Aug. 2017
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 am 10 Aug. 2017
Thanks. It must have function and not a result or call to another function in other words..?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by