I am new to Matlab. I would like to integrate a function. I try int() and integrate() but they all cause problems to me - not enough parameters or other different errors, I have tried many combinations with documentation. My current code is the following, I would like to be able to pass numbers p and q to res and obtain a numerical result:
syms x;
w = 1;
hbar = 1.054571800*10^(-34);
k = (w/(pi*hbar))^(1/4);
e = @(q) (w*q/hbar)^(1/2);
waveF = @(q) k*exp(-feval(e,q)*feval(e,q)*1/2.0)*1.0/1;
func = @(p,q) waveF(q-x/2)*waveF(q+x/2)*exp(1i*p*x/(hbar));
res = @(p,q) int(func(p,q), x = -Inf..Inf);
Currently " x = " is indicated as en error although it seems ok according to the documentation.
Thanks.