Get the same value when using Integral2 function
Show older comments
I am using integral2 function to calculate the double integral. The source code is shown as follows:
%% Calculate the drag power for the bare fuselage
bl_bare = @(u,z) Oper.rho .* (u ./ Oper.Vinf) .* 0.5 .* (Oper.Vinf^2 - (u.^2));
ke_out_bare = @(u,z) Oper.rho .* (u ./ Oper.Vinf) .* 0.5 .* ((u - Oper.Vinf).^2);
% Perform double integral
q1_bare = integral2(bl_bare, 0, delta99, 0, 2*pi);
q2_bare = integral2(ke_out_bare, 0, delta99, 0, 2*pi);
D_bare = q1_bare + q2_bare;
%% Calculate the drag power for the bare fuselage with induced velocity field
v_induced = u .* (1 + a_fit);
v_slipstream = u .* (1 + (2 .* a_fit));
bl_induced = @(v_induced,z) Oper.rho .* (v_induced ./ Oper.Vinf) .* 0.5 .* (Oper.Vinf^2 - (v_induced .^2));
ke_out_induced = @(v_slipstream,z) Oper.rho .* (v_slipstream ./ Oper.Vinf) .* 0.5 .* ((v_slipstream - Oper.Vinf).^2);
% Perform double integral
q1_induced = integral2(bl_induced, 0, delta99, 0, 2*pi);
q2_induced = integral2(ke_out_induced, 0, delta99, 0, 2*pi);
D_induced = q1_induced + q2_induced;
However, q1_bare and q1_induced are the same, and q2_bare and q2_induced are the same as well.
I have checked that v_induced and v_slipstream are different from u. However, I cannot figure out why I got the same value.
u and a_fit are 1x30 double, and Oper.Vinf and Oper.rho are 1x1 double.
I appricate all the help. Thank you!
Accepted Answer
More Answers (0)
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!