# slope at defined co-ordinates

2 visualizaciones (últimos 30 días)
Gavin Seddon el 15 de Feb. de 2017
Respondida: Star Strider el 15 de Feb. de 2017
Hello I have defined my distance function as
d = (5757*x^3)/100000 - (2227*x^2)/10000 + (1303*x)/2500 + 25/2
I then differentiate this to get diff
(5757*x^3)/100000 - (2227*x^2)/10000 + (1303*x)/2500 + 25/2
ans =
(1303*x)/2500 - (4999*x^2)/100000 + 25/2
how would I calculate the gradient at varying X values?
Thanks. Gav.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Star Strider el 15 de Feb. de 2017
The gradient is simply the derivative, since yours is a univariate function. I would create a vectorized anonymous function from it, and use it as I would any other function:
dd_dx = @(x) (1303*x)/2500 - (4999*x.^2)/100000 + 25/2;
then call it as:
x = linspace(0, 10);
figure(1)
plot(x, dd_dx(x))
grid
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Assembly 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