Borrar filtros
Borrar filtros

Finding all the zeroes of a discontinuous function in a particular range

4 visualizaciones (últimos 30 días)
I am trying to find the zeroes of the following symbolic function.
syms x
moment =20*heaviside(x - 8)*(x - 8) - (3*x^2*heaviside(x))/4 + 5*heaviside(x - 20)*(x - 20) +...
(3*heaviside(x - 20)*(x - 20)^2)/4;
fplot(diff(moment,1),[-2 20])
solve(diff(moment,1) == 0, x, 'MaxDegree', 4);
extrema = vpa(ans, 6)
Matlabs outputs
extrema =
ans =
However, the first derivative of the above moment function has a number of zeroes located at points other than -1, for example at approximately x = 13. Could someone please explain how all the zeroes or the zeroes in a particular range can be found?

Respuesta aceptada

Star Strider
Star Strider el 27 de Oct. de 2020
It may be version-dependent.
In R2020b (Update 1), I get:
extrema =
ans =
Plotting the function as well as the derivative:
fplot(diff(moment,1),[-2 20])
hold on
fplot(moment,[-2 20])
hold off
supports those.

Más respuestas (0)


Más información sobre Graphics Object Properties en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by