Pregunta

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)

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top