Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve in Matlab by typing the code in the program and solve parts a and b for problem 1. Thanks OBJECTIVES Explore various approaches

image text in transcribedPlease solve in Matlab by typing the code in the program and solve parts a and b for problem 1. Thanks
OBJECTIVES Explore various approaches for differentiating data numerically. Learn how to write a user-defined function to implement a higher order fini Explore various approaches for integrating data numerically Understand the difference between trapz and cumtrapz Learn how to use the integral function . te difference formula. INSTRUCTIONS: Write a single MATLAB m-file that solves all problems below. Call external user-defined functions from your m-file where instructed as well as to minimize naming conflicts, organize your work and plify debugging. For each problem, write the requested answers to ASCII data files with the exact filenames sim pecified (e.g. "A3.dat"). Submit your main m-file and all associated function m-files on paper; submit any ASCII files by ema Problem I Consider the data in "PA7velocity.txt". This data file contains time in the first column and velocity measurements in the second column. For this problem you will be differentiating the data to calculate the derivative of the velocity as a function of time, namely the acceleration. Differentiate this data directly using the gradient function. Save your results in a column vector (41* 1) a) b) Calculate the derivative using diff4ex.m (or write your own function using the same O(h) finite differencing scheme) and save the result in a column vector (41 x 1). Note this function from the course es uses O(ht) accurate centered finite differencing with O(h) forward and backward finite differences to calculate the derivatives at the first two and last two times respectively. Fit a cupic spline with "not-a-knot" end conditions to the data using t [0:0.05:20]. Again differentiate this data using the gradient function and store the results in a column vectors (401x1) d) Calculate the derivative by first fitting the model equation below to the data using nonlinear regression (note this is the same curve fit as you did in PA5). Use fminsearch with initial guesses for the fit coefficients of [I 1 1 1] and a tolerance of 1E-6 for both TolX and TolFun. (t) AeBcos (Ct + D) Calculate the analytical derivative by hand and use the resulting expression in your mfile to calculate numerical results for the acceleration corresponding to the time values in the original data set. Save the results in a column vector (41xI). Make sure to maintain full precision in your model constants by doing all calculations with variables. e) Use the same O(h) accurate differencing scheme from (b) to calculate the derivative of the curve fit you generated for part (d) at the time values in the original data set. Save the result in a column vector (41x1). ANSWERS: Write your results for parts (a) through (e) to Al.dat - A5.dat

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Summary of coca cola and european contamination crisis

Answered: 1 week ago