Error: A and B must be floating point scalar? Using Integral function.

Using the integral function I am encountering the error as stated in the title. For the code down below my input is a table of a single column which I convert into an array. To see why this error was occuring within integral, I found that the class type for my second parameter in the integral is 'double'.
This error appears when my input EV is a 494x1 table as I need the integral to go through the first value in the table to the last.
function [y] = Jr_Zero(EV)
constant = 9.88279.*10.^22;% this is 2pi/h^3 c^2
kt = 0.0257 ;
electron = 1.602.*(10.^(-19));
data = [] ;
fun = @(x) (constant.* (x.^2)).*(1./((exp(x/kt)-1)));
convert1 = table2array(EV);
for i = convert1
J = integral(fun,1.9,i);
data = [data J];
end
y = (0.1.*(2.*electron).*data); % Acm^(-2)
end

 採用された回答

darova
darova 2020 年 5 月 6 日

0 投票

Try this solution

1 件のコメント

Christopher Luu
Christopher Luu 2020 年 5 月 8 日
Thank you! That has done exactly what I needed it to do.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConstruct and Work with Object Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by