Function in Matlab that calculates the nth derivative
Show older comments
I want the code for a function that calculate the nth derivative without using built in function like "diff".
9 Comments
Daniel Pollard
on 5 Jan 2021
What have you tried so far?
lilo moutila
on 5 Jan 2021
John D'Errico
on 5 Jan 2021
All of my functions are constants, so the nth derivative, (for n >= 1) is zero.
nthderiv = 0;
lilo moutila
on 5 Jan 2021
Daniel Pollard
on 5 Jan 2021
If you're a complete beginner I'd suggest checking out the Matlab Onramp course, which covers all the basics you need to get started. If you've done that and are happy with basic functions, arrays and the syntax, then the next step would be to have a look at the wikipedia page for numerical differentiation. The first section on finite differences is likely what you need.
After that, have a go at writing a function which estimates a derivative. If you have a specific question about Matlab or its applications then post that, but posting a relatively advanced homework question without even trying doesn't look great.
lilo moutila
on 5 Jan 2021
John D'Errico
on 5 Jan 2021
There was no point to my comment, but your question has no meaningful answer. If you cannot use a tool like diff, then this is homework. Homework is there for you to solve, not for us to do for you.
Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!