Say if i have 5 data points and plotted it out as a scattered line curve in excel, how can i possibly find the gradient of every points on the curve in excel? Please help !
Say if i have 5 data points and plotted it out as a scattered line curve in excel, how can i possibly find the gradient of every points on the curve in excel? Please help !
I often find that I must first understand the mathematical principles behind a problem before I can work out the programming. Are you using the term "gradient" to mean "derivative" or "slope", so that this becomes a calculus problem?
If that is the case, the approach I would generally use for something like this is to regress a "best fit" function for the 5 data points, then use calculus to determine the formula for the first derivative of that function, then program that formula into Excel.
If your function is "linear", then you can perform the regression using the LINEST() function https://support.office.com/en-us/art...rs=en-US&ad=US
Excel does not really know calculus, so it will be up to you to know how to take the derivative (symbolically or numerically).
Once you have that, then it should be straightforward to program that into Excel.
Originally Posted by shg
Thank you for your reply. To be frank I have no experience in integrating programming into Excel to perform computation for something even though I have the knowledge of calculus. Is it possible for you to randomly put 5 data points, plot out the graph and insert the formula as you said that can output the slope of every points on the curve for me as an example? Thank you.
I won't be able to right away (obviously, after 8 hours). It will be difficult to provide a useful example without f(x) or f'(x), which I assume you already know. Do you know if your desired f(x) is "linear" or "non-linear", so we will know if the LINEST() function is appropriate?
I'm not sure how to interpret this statement. Perhaps we need to start at some very basic help for using formulas in Excel. If you are truly and completely unfamiliar with how to program computations into Excel, I might start with a help file like this: https://support.office.com/en-us/art...rs=en-US&ad=US to become familiar with the basic principles for performing calculations in Excel. If and when I get around to putting an example together, it will depend on you understanding basic formula syntax, including cell referencing and other basic concepts.To be frank I have no experience in integrating programming into Excel to perform computation for something even though I have the knowledge of calculus.
Here's a sample that I very quickly put together. I used a simple straight line (y=mx+b), which means that the slope calculation is almost trivial, since slope is independent of x. This should illustrate the basic steps (regression, differentiation, calculation of slope at x) that I would use for this kind of thing.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks