Function in Matlab that calculates the nth derivative

I want the code for a function that calculate the nth derivative without using built in function like "diff".

9 comentarios

What have you tried so far?
Rik
Rik el 5 de En. de 2021
It is not possible to do anything without builtin functions. If this is your homework question you should ask a specific question. You can find guidelines for posting homework on this forum here.
@Rik we can use built in functions but not "diff"
All of my functions are constants, so the nth derivative, (for n >= 1) is zero.
nthderiv = 0;
@John I don't get your point
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.
Thank you so much for your help
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Preguntada:

el 5 de En. de 2021

Comentada:

el 5 de En. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by