Why integral2 won't work, is there a solution?

2 visualizaciones (últimos 30 días)
Emmanouil Grigoriou
Emmanouil Grigoriou el 28 de Jul. de 2016
Respondida: Dipak kumar Panigrahy el 21 de Mayo de 2020
Hello everybody,
In the following code I don't understand why integral2 doesn't work. Could you suggest me a solution to achieve the integration? Currently I am calculating many values with vpa and then I use twice trapz to make it work but it takes really long and the accuracy is not very good...
Thank you in advance
clear all
WaveFunction = @(x) exp(-x.^2./2)./pi.^(0.25);
expression1 = @(x,p,y) exp(-i.*p.*y).* WaveFunction(x-y./2).* conj(WaveFunction(x+y./2));
syms y
WignerFunction = @(x,p) 1/(2.*pi).* int(expression1(x,p,y),y,-Inf,Inf);
t = isa(WignerFunction,'function_handle') % outputs 1
%vpa(WignerFunction(1,1)) % outputs the correct value
t = integral2(WignerFunction,-Inf,Inf,-Inf,Inf) % should output 1

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Jul. de 2016
int() returns a symbolic expression, which might or might not contain any free variables. integral() and integral2() can only work with numeric expressions, not symbolic expressions.
If your int() returns a symbolic expression that has no unbound variables, then you can use
WignerFunction = @(x,p) 1/(2.*pi).* double(int(expression1(x,p,y),y,-Inf,Inf));

Más respuestas (1)

Dipak  kumar Panigrahy
Dipak kumar Panigrahy el 21 de Mayo de 2020
clear
clc
syms rtstar
syms rt1 v delta R %or assign numeric values to the variables
p=10;
cdf1=p*tan(delta)*R^2;
cdf2=p*tan(delta)*R^2;
eqn = ss == (int(int(cdf1,rt,rt1,rtstar),e,0,v)-int(int(cdf2,rt,rtstar,rt2),e,0,v));
sol = solve(eqn, rtstar)
can any one tell me how to solve for rstar

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by