Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Derivative code

8 views
Skip to first unread message

sagi

unread,
Oct 5, 2016, 3:00:06 PM10/5/16
to
Can anyone share a Derivative code with me?
(not the "diff" function) I need a code that will do derivative to a mathematical function that the user will enter.

I want to use the GUI menu, so the mathematical function will enter in that menu, and i will show the graph of the function and the derivative of the function. and later will enter also a value, to the function.

Thank you.

James Tursa

unread,
Oct 5, 2016, 3:21:09 PM10/5/16
to
sagi <sagi...@gmail.com> wrote in message <96696132.60607.147569...@sodium.mathforum.org>...
But the diff( ) function does this for you with symbolic inputs (you need the Symbolic Toolbox). E.g.,

>> syms x

>> f = 3*x^2 + 2*x + 1
f =
3*x^2 + 2*x + 1
>> diff(f)
ans =
6*x + 2

>> f = sin(x)^2
f =
sin(x)^2
>> diff(f)
ans =
2*cos(x)*sin(x)

James Tursa

sagi

unread,
Oct 5, 2016, 4:10:05 PM10/5/16
to
yes,
but i need a way without using the "diff" function.
is there any possiable code to write that will do that?
is there any code for that anywhere that i can copy?
or maybe it is not much effort to do for some experienced matlab user?

just for simple mathematical function (polynomials)

dpb

unread,
Oct 5, 2016, 5:09:14 PM10/5/16
to
On 10/05/2016 2:54 PM, sagi wrote:
...

>
> just for simple mathematical function (polynomials)

doc polyder

All you'd have to do is write an output formatting line which is one
line of code if you're not wanting fancy, possible a few more to have
actual TeX formulae or the like...

James Tursa

unread,
Oct 5, 2016, 6:13:08 PM10/5/16
to
sagi <sagi...@gmail.com> wrote in message <127990244.60710.14756...@sodium.mathforum.org>...
Do not create a new thread when replying to a post. This makes it hard to follow the conversation. Instead, do a reply to the existing post.

James Tursa

dpb

unread,
Oct 6, 2016, 10:06:37 AM10/6/16
to
Altho POLYDER does handle only the one-variable polynomials...you'd have
to code up something for general case.
0 new messages