Saturday 6 April 2013

Finding the gradient of a graph

Having installed Octave I now want to find gradients of gradients of gradients...... of gradients.

This is a note to remind me to do this.

So, turns out there is a function which does this:
gradient(F)

so, here's me plotting a sine wave, and then drawing gradients of that graph:


x=0:0.1:20
y=sin(x)

plot(y)
hold all
plot(gradient(y)*10)
hold all
plot(gradient(gradient(y))*100)
hold all
plot(gradient((gradient((gradient(y)*10))*10))*10)
plot(gradient((gradient((gradient((gradient(y)*10))*10))*10))*10)



No comments:

Post a Comment