Write a VBA code that will calculate and display the values of the given functio
ID: 643328 • Letter: W
Question
Write a VBA code that will calculate and display the values of the given function f(x) and the first derivative f'(x)
the user should be able to:
Enter the function into a cell in the main sheet.
Enter the minimum, maximum and increment
Test your code with the following
For the following x values: -10 <= x <= 10 increment of 1 and increment 0.5
The program should read the Xmin, Xmax and Increment form Cell E3,F3 and G3 respectively, (Use range name: Xmin,Xmax,Xincr)
The program should have a button to start the calculation and display (Calculate)
Write a function f(x) that would take an argument the x value and return the corresponding y value.
Write a function fp(x) that would take an argument the x value and return the corresponding y' value using , where dx is very small increment dx=0.00001.
This function should be able to use the defined function the main sheet. Make sure you are not hard coding the function the VBA code.
Make sure you clear range content (x and f(x) before you fill the data
Graph the function as shown below, label your axis and give the chart a title
Graph the derivative f'(x)
Explanation / Answer
For i = 0 To 20
x(i) = -10+i
y(i) = Math.Sin(x(i))/x(i)
Chart1.Series(0).Points.AddXY(x(i), y(i))
Next
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.