Question

In: Advanced Math

write a matlab code to find the following: initial position, initial velocity, and acceleration using the...

write a matlab code to find the following: initial position, initial velocity, and acceleration using the algorithm and information below

time(seconds). height(m) velocity(m/s)
0. 0.2. 2.95

algorithm:
1. Enter data in to arrays.
2. Fit the height data to a 2nd order polynomial.
3. Evaluate the polynomial at enough points to get a smooth curve.
4. Find the velocity model by taking derivative of the height polynomial.
5. Evaluate the velocity polynomial at enough times to get a smooth curve

Solutions

Expert Solution


%%Matlab code for time velocity polynomial
clear all
close all

%all height and time data
t=[0 1 2 3 4 5 6 7 8 9 10];
h=[0.1 1.3 4.2 9.9 16.1 25.2 36.9 50.1 65 80.1 98.1];

%2nd order polynomial fit
pp=polyfit(t,h,2);

%smooth t data
tt=linspace(0,10,101);
%polynomial values
hh=polyval(pp,tt);

figure(1)
%plotting of actual and fitted data
plot(t,h,'r*')
hold on
plot(tt,hh)

xlabel('time')
ylabel('height')
title('time vs. height plot')
legend('Actual data','2nd order polynomial')

%function for height n 2nd order polynomial
syms x
h1(x)=pp(1)*x^2+pp(2)*x+pp(3);

fprintf('\t2nd order polynomial fit for height = ')
disp(vpa(h1,4))

%derivative of the function
v(x)=diff(h1,x);

fprintf('\t2nd order polynomial fit for velocity = ')
disp(vpa(v,4))

%all velocity values

for i=1:length(tt)
    vv(i)=double(v(tt(i)));
end

figure(2)
plot(tt,vv)
xlabel('time')
ylabel('velocity')
title('time vs. velocity plot')

%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%%


Please enter your own data and rerun the code.


Related Solutions

Matlab code please 6. Find the velocity, acceleration, and speed of a particle with the given...
Matlab code please 6. Find the velocity, acceleration, and speed of a particle with the given position function. (a) r(t) = e t cos(t)i+e t sin(t)j+ tetk t = 0 (b) r(t) = 〈t 5 ,sin(t)+ t 2 cos(t),cos(t)+ t 2 sin(t)〉, t = 1
Write a simple matlab program to model the position, velocity, and acceleration over time of Ruchardt's...
Write a simple matlab program to model the position, velocity, and acceleration over time of Ruchardt's experiment as a harmonic oscillator.
Suppose that a particle has the following acceleration vector and initial velocity and position vectors. a(t)  ...
Suppose that a particle has the following acceleration vector and initial velocity and position vectors. a(t)  =  7 i  +  9t k,    v(0)  =  4 i  −  j,    r(0)  =  j  +  5 k (a) Find the velocity of the particle at time t. (b) Find the position of the particle at time t.
1) Find the velocity and position vectors of a particle that has the given acceleration and...
1) Find the velocity and position vectors of a particle that has the given acceleration and the given initial velocity and position. a(t) = 7i+ 4j,    v(0) = k,    r(0) = i 2) Find the tangential and normal components of the acceleration vector. r(t) = 5(3t − t3) i + 15t2 j
Matlab code problems I have to write a code using functions to find out if a...
Matlab code problems I have to write a code using functions to find out if a year is a leap year. I'm on the write track i feel like but I keep getting an error message and matlab isnt helping to troubleshoot. The issue is on line 30. Here is my code: function project_7_mfp() %   PROJECT_7_ABC   project_7_abc() creates a function that prompts the user %   enter a year after 1582 It then determines if it is a leap year %...
Find the velocity, acceleration, and speed of a particle with the given position function. r(t) =...
Find the velocity, acceleration, and speed of a particle with the given position function. r(t) = 2 cos(t), 2t, 2 sin(t)
Find the velocity, acceleration, and speed of a particle with the given position function. r(t) =...
Find the velocity, acceleration, and speed of a particle with the given position function. r(t) = 9 cos(t), 8 sin(t) v(t) = a(t) = |v(t)| = Sketch the path of the particle and draw the velocity and acceleration vectors for t = π 3 .
Will it be possible to find the initial velocity using Newton
Will it be possible to find the initial velocity using Newton
Consider example of any four bar mechanism. first perform the kinematic analysis(Position,Velocity,Acceleration).And then find the following...
Consider example of any four bar mechanism. first perform the kinematic analysis(Position,Velocity,Acceleration).And then find the following Complete Free body diagram. Complete Matrix equation for the mechanism force analysis. Values of all Variables involved ( mass, mass moment of Inertia, Force, Torque ). Equations used for mass, mass moment of Inertia of each link. Find center of Percussion of a sports stick, racket or bat
Write a MATLAB script or function that returns the required initial velocity of the ping pong...
Write a MATLAB script or function that returns the required initial velocity of the ping pong ball required to launch it a specified distance. Use projectile motion equations. Keep in mind that the initial firing height will change depending on the proposed catapult design. Primary considerations in the catapult design are accuracy and repeatability as groups will be tasked with hitting the target (cup) repeatedly at distances ranging from 7 to 9 ft. (cup moved in 6 in. increments).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT