Why integral2 won't work, is there a solution?
Show older comments
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
Accepted Answer
More Answers (1)
Dipak kumar Panigrahy
on 21 May 2020
0 votes
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
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!