Question
I suspect the answers to the following questions are obvious, but I'm new to coding and don't understand the basics. I am not asking for
I suspect the answers to the following questions are obvious, but I'm new to coding and don't understand the basics. I am not asking for a solution to the following question, but I do need clarification on a few things within. The question reads, "Generate an O(h2) (second-order) approximation to the first derivative of some function f(x) using 3 points, x0,x1 and x2 using the polynomial interpolation approach. Give the finite difference formulas for each of the points x0, x1, and x2. Assume they are equally spaced, with spacing h."
How would I define an unspecified function in MATLAB using the given points?
For example, I could define a function f = @sin(x); How do I define a general function f(x) with x0, x1, and x2.
How would I set up the points to be evenly-spaced?
For example, I could generate evenly-spaced points with the following code: xe = linspace(-1,1,1000)'; which gives me 1000 points between -1 and 1, but how would I do this generically with h?
Thanks!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started