integration error in matlab
1 view (last 30 days)
Show older comments
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/292067/image.jpeg)
Hi all,
i am trying to solve the above equation in matlab, but i am getting an error as Error in integralCalc while solving the code
any suggestions and thanks in advance
clc;
clear;
ro = 17.5; R = 65;
a1 = 1/2*((((1+4*(ro.^2))/(1-(ro.^2))).^(1/2)) -1);
a2 = -1/2*((((1+4*(ro.^2))/(1-(ro.^2))).^(1/2)) -1);
% let X0<x<1.22*X0 replace X0 with ro and 1.22*X0 as b
b = 1.22*ro;
% first condition R (main radius = 65) R>r>b
x = b:5:R;
y = ro:0.45:b;
func1 = @(x)((-x.^3)/((1-x.^2).*((x.^2)-a1).*((x.^2)-a2)).^(1/2));
i = zeros(size(x));
for c = 1:length(x)
i(c) = integral(func1,0,x(c));
end
func2 = @(y)((-y.^3)/((1-y.^2).*((y.^2)-a1).*((y.^2)-a2)).^(1/2));
i = zeros(size(y));
for c = 1:length(y)
i(c) = integral(func1,0,y(c));
end
0 Comments
Accepted Answer
Walter Roberson
on 11 May 2020
Always use ./ instead of / unless you intend to do algebraic matrix division similar to A/B meaning A matrix-multiply pinv(B)
More Answers (0)
See Also
Categories
Find more on Logical 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!