Question: Could you plz do both part1 and part2 by using Matlab? Thank you so much! 1. Your first homework programming assignment is to write code

Could you plz do both part1 and part2 by using Matlab? Thank you so much! Could you plz do both part1 and part2 by using Matlab? Thank

1. Your first homework programming assignment is to write code that numerically approacimates the derivative of the function f(a) for a value provided by the user of the program, and prints the result. Recall that f'(a) Jina+h)-f(0) Write and SUBMIT a Matlab program to compute an approximate derivative of () for arbitrary and h. Details: Your code will require the user to input both a and h (plus tol for Part II) and then calculate and display the difference quotient. (a) Part 1 - (14 points) Coding: For this part of the assignment, you just need to write code that will compute the difference quotient for whatever h is chosen by the user of your program. If you complete this part, your code should print the value of ah and your approximation of '(a) to the screen. Descriptive output can be generated using a fprintf command: fprintf('Using a - %6.4f and h-X6.40, 1'' (%5.3f) - X24.16E.'. \ldots); with appropriate variable names replacing the..., of course. And please make sure to follow the guidelines with regard to commenting, variable declarations, preamble, and nicely formatted output. (b) Part II - (4 points) Loops (and formatting control): Now it is time to think about the limit, which you'll do by constructing a table for a sequence of values for h. To complete Part Il you'll need to modify your code from Part I to calculate numerical values of the derivative using a loop structure, which stops once tol, where to is third user input. I used the line - 1/100 within my loop to produce the sample table below, and you can do the same. Your code should return both the value of hand the numerical approximation to the derivative of (x) = using the numerical approximation above to print a table to the screen that looks as similar in layout at you can to this one: (2) 2.000011.00000015.00000000E+001 2.000011.0000-0214.01000000E+001 2.000011.0000-0414.00010000E001 2.000011.0000-0614.00000100E+001 As you can see, I started with a 2 and has 1 in my input, and an until

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!