- #1

- 5

- 0

## Main Question or Discussion Point

Hi, I have a problem with my matlab code. The error is: "Function 'diff' is not supported for class 'function_handle'."

I have installed the toolbox Symbolic Math Toolbox after the installation of Matlab, but I think that it works, so my code is this:

Can you see the mistake? Thank you for your help. Bye.

I have installed the toolbox Symbolic Math Toolbox after the installation of Matlab, but I think that it works, so my code is this:

Matlab:

```
t=2;
alpha=2;
p_0=20;
c=10;
eta=0.2;
mu=10;
sigma=0.5;
syms p;
x=@(p) t^(-alpha-1)*exp(-((t^2)/2)-p*t);
D=@(p)(exp(-(p^2)/4)/gamma(alpha))*integral(x,0,Inf);
psi=@(p) exp(eta((p-mu)^2/2*(sigma)^2))*D*(((p-mu)/sigma)*sqrt(2*eta));
Theta=@(p) (p-c)*diff(psi)-psi;
fzero(Theta,p_0)
```