Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve by showing the Matlab code typed into the program for parts c and d for problem and please label parts for problem 1.

image text in transcribedPlease solve by showing the Matlab code typed into the program for parts c and d for problem and please label parts for problem 1. Thanks
OBJECTIVES: xplore various approaches for differentiating data numerically formula. Learn how to write a user-defined function to implement a higher order finite difference Explore various approaches for integrating data numerically Understand the difference between trapz and cumtrapz .Learn how to use the integral function. 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 w work and For each problem, write the requested answers to ASCII data files with the exact filenames specified (e.g. "A3. dat"). Submit your main m-file and all associated function m-files on paper; submit any ASCII files by email. Problem 1 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. ra) Differentiate this data directly using the gradient function. Save your results in a column vector (41*1). 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 ). Note this function from the course notes uses O(h) 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 cFit 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). 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 [1 1 1 1] and a tolerance of IE-6 for both TolX and TolFun. d) (t) = AeBt COS (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 (41xl). 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 (41-1) 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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

What are the different ways in which work can be scheduled?

Answered: 1 week ago