How do I integrate a piecewise function with an upper bound variable
14 views (last 30 days)
Show older comments
As shown in the code, the Angle function alpha is a piecewise function with respect to r (the others are known sign values), and it can be performed as an indeterminate integral or a definite integral of a definite value, but it cannot be calculated when the upper limit of the integral is the variable r. The error message is that the continuity of the function in the integral interval cannot be determined.
...
syms r alpha(r)
alpha(r) = piecewise((r >= part_p(1, 1)) & (r <= part_p(2, 1)), alpha_part(1));
for i = 2:11
alpha(r) = piecewise((r > part_p(2*i-2, 1)) & (r <= part_p(2*i-1, 1)),...
atan(((-1)^(mod(i, 2)) * (r - cir_x(i)) / sqrt(cir_r(i)^2 - (r - cir_x(i))^2))), alpha(r));
alpha(r) = piecewise((r > part_p(2*i-1, 1)) & (r <= part_p(2*i, 1)),...
alpha_part(i), alpha(r));
end
syms arcLength(r)
arcLength(r) = int(sqrt(tan(alpha)^2 + 1), [part_p(1, 1), r]);
5 Comments
Sam Chak
on 16 Dec 2024
It is somewhat difficult to interpret the lines from a mathematician's perspective. Therefore, I attempted to separate them. The sub-functions of part_p() and alpha_part() are unknown. Are they mathematically defined, or do they refer to a table (cell) from which you extract fixed values?
syms alpha(r)
condition_1 = r >= part_p(1, 1); % condition 1
condition_2 = r <= part_p(2, 1); % condition 2
outcome = alpha_part(1); % outcome
%% Piecewise function
alpha(r) = piecewise(condition_1 & condition_2, outcome);
Answers (0)
See Also
Categories
Find more on Assumptions 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!