Please use Matlab to write to code Write a code that can cal
Please use Matlab to write to code.
Write a code that can calculate the second derivative f\"(x) based on the forward difference, given values of f(x) and x. Moreover, the code should plot your results of f\"(x) vs. x. Test your code for the following set of values position vs. time in order to calculate acceleration vs. time and plot your results.Solution
syms a b; th = sym(\'th(t)\'); %th is a time dependent variable y = diff(a^2*cos(th)+(b/12)*sin(th)); thd = diff(th); %derivative of th wrt time ybythd = diff(y,thd); %derivative of y wrt thd p = diff(ybythd); %derivative of ybythd wrt time