# A and B must be floating-point scalars.

2 ビュー (過去 30 日間)
nikhil 2020 年 1 月 31 日
コメント済み: nikhil 2020 年 2 月 1 日
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 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

#### 1 件のコメント

nikhil 2020 年 2 月 1 日
Thanks Sergey kasyanov for your time and code is working is perfectly

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

### Community Treasure Hunt

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

Start Hunting!

Translated by