A and B must be floating-point scalars.

1 次查看(过去 30 天)
i am trying to integrate this function and while solving this function i am getting an error as A and B must be floating point scalars
below is my code
R = 90; ro = 17.5; tht = asind(ro/R); b= 1.225*ro; b_bar = b/R; %tht is winding angle
r = ro:0.25:b;
ro_bar= ro/R;
k1 = 1/2*(sqrt((1+3*(ro_bar).^2)/(1-(ro_bar).^2))-1);
k2 = 1/2*(-sqrt((1+3*(ro_bar).^2)/(1-(ro_bar).^2))-1);
r_bar = r/R; r1 = b:5:R; r_bar1 = r1/R;
b_1 = r1/R;
k = sqrt ((1-k1)/(1-k2));
x= asind(sqrt((1-((r_bar).^2)))/(1- k1)) % sin(theta) from r0 to b
y = asind(sqrt((1-((b_1).^2)))/(1- k1)); % sin(theta_star)from b to R
fun = @(x)1./(sqrt(1-(1.3742*(sin(x).*sin(x)))));
i = integral (fun, x, 0, t);

采纳的回答

Sergey Kasyanov
Sergey Kasyanov 2020-1-31
Hello,
You need to replace i = integral (fun, x, 0, t); to one of variants below:
If you want to integrate in x range (from x(1) to x(end)) try that:
i = 0;
for c=1:length(x)
i = i + integral(fun,x(c),x(c+1));
end
If you want to take some integrals in range 0 to x(i) for each i try that:
i = zeros(size(x));
for c = 1:length(x)
i(c) = integral(fun,0,x(c));
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by