Error: A and B must be floating point scalar? Using Integral function.
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Construct and Work with Object Arrays 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!