Integral "int" function not evaluating

5 ビュー (過去 30 日間)
Ali Almakhmari
Ali Almakhmari 2022 年 3 月 3 日
コメント済み: Walter Roberson 2022 年 3 月 6 日
Why is the "int" function not evaluating my integral? The "r" variable still has the "int" in it.
clear
clc
theta_s = 0:0.5:pi/2;
syms theta_v phi
for i = 1:length(theta_s)
integ2(i) = ((((1/(2*pi))*((pi-phi)*cos(phi) + sin(phi))*tan(theta_s(i))*tan(theta_v)-(1/pi)*(tan(theta_s(i))+tan(theta_v)+sqrt(tan(theta_v)^2 + tan(theta_s(i))^2 - 2*tan(theta_s(i))*tan(theta_v)*cos(phi)))))*cos(theta_v)*sin(theta_v));
r(i)= int((integ2(i)), theta_v, [0 pi/2]);
end
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 3 月 3 日
What reason do you have to lead you to expect that there is a closed form integral?

サインインしてコメントする。

採用された回答

David Hill
David Hill 2022 年 3 月 3 日
theta_s = 0:0.5:pi/2;
syms theta_v
phi=pi/6;%choose a phi or loop for various values of phi
for i = 1:length(theta_s)
integ2(i) = ((((1/(2*pi))*((pi-phi)*cos(phi) + sin(phi))*tan(theta_s(i))*tan(theta_v)-(1/pi)*(tan(theta_s(i))+tan(theta_v)+sqrt(tan(theta_v)^2 + tan(theta_s(i))^2 - 2*tan(theta_s(i))*tan(theta_v)*cos(phi)))))*cos(theta_v)*sin(theta_v));
r(i)= vpaintegral((integ2(i)), theta_v, [0 pi/2]);
end
  6 件のコメント
David Hill
David Hill 2022 年 3 月 4 日
Works fine.
theta_s = 0:0.5:pi/2;
syms theta_v phi
for i = 1:length(theta_s)
integ2(i) = ((((1/(2*pi))*((pi-phi)*cos(phi) + sin(phi))*tan(theta_s(i))*tan(theta_v)-(1/pi)*(tan(theta_s(i))+tan(theta_v)+sqrt(tan(theta_v)^2 + tan(theta_s(i))^2 - 2*tan(theta_s(i))*tan(theta_v)*cos(phi)))))*cos(theta_v)*sin(theta_v));
r(i)= vpaintegral(vpaintegral((integ2(i)), theta_v, [0 pi/2]),phi,[0 pi]);
end
Walter Roberson
Walter Roberson 2022 年 3 月 6 日
By the way, integrating first with respect to phi is faster.
At one point I saw a closed form solution for integration with respect to phi, but I was not able to reproduce that later.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by