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
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
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).
The following code must be written using matlab and must be using a for-loop. NOTE! Write...
The following code must be written using matlab and must be using a for-loop. NOTE! Write a computer program that assigns random integers for each entry and generates a row vector. Different random integers should be drawn from different intervals for position 1, position 2, position3 and position 4 of the array. After these first 4 positions are drawn. The whole thing should start over where position5 drawn from same interval as positions 1, position6 drawn from same interval as...
The following code must be written using matlab and must be using a for-loop. NOTE! Write...
The following code must be written using matlab and must be using a for-loop. NOTE! Write a computer program that assigns random integers for each entry and generates a row vector. Different random integers should be drawn from different intervals in chunks of 4 , that is chunk1-chunk2-chunk3-chunk4 The parameters for specifying the lintervals by which the random numbers should be drawn should be able to change and be hardcoded in the script, however, be hardcoded in the script.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT