matlab - Error using integral: A and B must be floating-point scalars -


i want evaluate simple example of integral

a = max(solve(x^3 - 2*x^2 + x ==0 , x));  fun = @(x) exp(-x.^2).*log(x).^2; q = integral(fun,0,a) 

and error is

error using integral (line 85) , b must floating-point scalars. 

any tips? lower limit of integral must function, not number.

the matlab command solve returns symbolic result. integral accepts numeric input. use double convert symbolic numeric. code written now, max should throw error due symbolic input. following works.

syms x; = max(double(solve(x^3 - 2*x^2 + x))); fun = @(x) exp(-x.^2).*log(x).^2; q = integral(fun,0,a) 

output: 1.9331.

the lower limit of integral must function, not number

integral numeric integration routine; limits of integration must numeric.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -