Why integral2 won't work, is there a solution?
2 ビュー (過去 30 日間)
古いコメントを表示
Emmanouil Grigoriou
2016 年 7 月 28 日
回答済み: Dipak kumar Panigrahy
2020 年 5 月 21 日
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
0 件のコメント
採用された回答
Walter Roberson
2016 年 7 月 28 日
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));
0 件のコメント
その他の回答 (1 件)
Dipak kumar Panigrahy
2020 年 5 月 21 日
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
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!