Question

How can i make the limits of integration scalars?

y = rand(150000,1);

x = rand(150000,1);

u=y.^x;

v=y;

z = quad(@(u) 1./log(v),0,u);

Error using quad (line 70) The limits of integration must be scalars.

Error in lnplot (line 5) z = quad(@(u) 1./log(v),0,u)

Was it helpful?

Solution

Your problem is that u is a vector with length 150000 (as you are doing element-by-element multiplication in u=y.^x).

The integration limit must be a scalar, but 'u' is a matrix. You need to determine which fixed value the integration runs to.

The scalar value depends on your data set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top