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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

태그

질문:

2020년 5월 6일

댓글:

2020년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by