Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in matlab please help me solve rite a single m-file that solves the problem and name it LastNameProblem1. Write your results for (1) to (5)
in matlab please help me solve
rite a single m-file that solves the problem and name it LastNameProblem1. Write your results for (1) to (5) to A1.dat, A2.dat, A3.dat, A4.dat and A5.dat. 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, i.e. acceleration. 1) Differentiate the data using the gradient function. Save your results in a column vector (411). Use t as your spacing. 2) Calculate the derivative using diff4exm and save the result in a column vector (411). Note this function from class uses O(h4) accurate centered finite differencing with O(h2) forward and backward finite differences to calculate the derivatives at the first two and last two times, respectively. 3) Fit a cubic 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 vector (4011) 4) Calculate the derivative by first fitting the model equation below to the data using nonlinear regression (note this the same curve fit as you did in Homework 5). Use fminsearch with initial guesses for the fit coefficients of [1111] and a tolerance of 1E6 for both TolX and TolFun. v=AeBtcos(Ct+D) Calculate the analytical derivative by hand and use the resulting expression in your-mile to calculate numerical results for the acceleration corresponding to the time values in the original data set. Save the results in a column vector (411). Make sure to maintain full precision in your model constants by doing all calculations with variables. 5) Use the same O(h4) accurate differencing scheme from part (2) to calculate the derivative of the curve fit you generated for part (4) at the time values in the original data set. Save the result in a column vector. Using the diff4ex.m function file againStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started