Diff (f(x+h)-f(h))/h
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
if to the question: diffresensial (f(x+h)-f(h))/h for h>0. if you can help to formula?
3 commentaires
John D'Errico
le 8 Avr 2017
But this is your homework. We can help you to fix a problem, but you need to try it, as otherwise, you don't learn. So make an effort, instead of just giving up. Show where you are having a problem. Then you are more likely to get help here.
Réponses (1)
Star Strider
le 8 Avr 2017
The code is exactly as you wrote it for the actual calculation. To construct the function, see the documentation on Function Basics. You will have to test for ‘h>0’ (although the practical lower limit is 1E-8).
2 commentaires
Star Strider
le 8 Avr 2017
I cannot without completely giving you the solution. It is a very straightforward problem.
First, experiment with your equation alone and see how it works with various functions. So for example, if you are using your equation to take the numerical derivative of sin, your equation should return close to the same output as the cos of the same angle. (It will not be exactly the same, so close enough is good enough.)
When you are certain your equation is working, then read about functions in the link I gave you, and put it in a function file. Remember to test for h>0 in your function, write an error message if it is not. Read the documentation for the error function to help you with that.
Also, the first few lines of your function should describe your function, what it does, and how to use it, using comment lines (starting with % in each line).
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!