Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using MATLAB function Diff, find the velocity, acceleration, and jerk. The displ

ID: 3780259 • Letter: U

Question

Using MATLAB function Diff, find the velocity, acceleration, and jerk. The displacement of an instrument subjected to a random vibration test, at different instants of time, is found to be as follows: a) Please use MATLAB function diff to find the velocity dy/dt, acceleration and d^2y/dt^2, and jerk d^3y/dt^3 based on forward-difference with a step size, Delta t, of 0.05. Please plot t vs. y curve, t vs. dy/dt curve, t d^2y/dt^2 curve, and t vs. d^3y/dt^3 curve, respectively. b) Please use MATLAB functions polyfit by fitting a 11th degree polynomial for the data and use polyval and diff to find the velocity dy/dt, acceleration d^2y/dt^2, and jerk d^3y/dt^3. Please plot t vs. y curve, t curve, t vs. dy/dt curve, and t vs. d^2y/dt^2 curve, and t vs. d^3y/dt^3 curve, respectively. c) Please use MATLAB functions spline by fining a Not-a-knot Cable Spline to find the velocity dy/dt, acceleration d^2y/dt^2, and jerk d^3y/dt^3. Please plot t vs. y curve, t vs dy/dt curve, t vs. d^2y/dt^2 curve, and t vs. d^3y/dt^3 curve, respectively. Please note that the above t vs. y curses should be plotted on one graph (3 curves), t vs. dy/dt curves on one graph (3 curves), t vs. d^2y/dt^2 curves on one graph (3 curves) and t cs. d^3y/dt^3 curves on one graph (3 curves), respectively. Totally 4 graphs.

Explanation / Answer

h = 0.05;       % step size
t = 0.05:h:0.6;    % domain
tt = 0.05:0.6;
ys = [0.144 0.172 0.213 0.296 0.070 0.085 0.525 0.110 0.062 0.055 0.042 0.035]; %range
Y1 = ys;
dY1 = diff(ys)/h;   % first derivative
d2Y1 = diff(dY)/h;   % second derivative
d3Y1 = diff(d2Y)/h;   %third derivative

p1 = polyfit(t, Y, 11);
p2 = polyfit(t, dY1, 11);
p3 = polyfit(t, dY2, 11);
p4 = polyfit(t, dY3, 11);
Y2 = polyval(p1, t);
dY2 = polyval(p2, t);
d2Y2 = polyval(p3, t);
d3Y2 = polyval(p4, t);
Y3 = spline(tt, Y, t);
dY3 = spline(tt, dY1, t);
d2Y3 = spline(tt, d2Y1, t);
d3Y3 = spline(tt, d3Y1, t);
figure
plot(t, Y1, 'ro')
plot(t, Y2, 'go')
plot(t, Y3, 'bo')
figure
plot(t, dY1)
plot(t, d2Y2)
plot(t, d2Y3)
figure
plot(t, d2Y1)
plot(t, d2Y2)
plot(t, d2Y3)
figure
plot(t, d3Y1)
plot(t, d3Y2)
plot(t, d3Y3)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote