[30] Q3. write a Matlab code that calculates the first derivative of f(x)-ex at x = 0 using forward differencing. Choose 4x = 0.5 initially and evaluate the absolute error in the derivative by comparing the numerical value with the analytical one. ii) Write a for loop that keeps halving Ax until it is less than 106 and evaluates the error in the numerical derivative for all the different 4x values. Finally, plot the error vs Δx in a log-log plot. Please print the plot. Do not submit the Matlab code only [30] Q3. write a Matlab code that calculates the first derivative of f(x)-ex at x = 0 using forward differencing. Choose 4x = 0.5 initially and evaluate the absolute error in the derivative by comparing the numerical value with the analytical one. ii) Write a for loop that keeps halving Ax until it is less than 106 and evaluates the error in the numerical derivative for all the different 4x values. Finally, plot the error vs Δx in a log-log plot. Please print the plot. Do not submit the Matlab code only



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *