You are on page 1of 20

%Time

t=[0:0.5:25];
x=35*t.^2-110*t;
y=115*t.^2-42*t.^3;
%Velocities
v_x=70*t-110;
v_y=230*t-126*t.^2;
%Resultant Velocity
v=sqrt(v_x.^2+v_y.^2);
%Acceleration
a_x=70;
a_y=230-252*t;
%Resultant acceleration
a=sqrt(a_x.^2+a_y.^2);

%PLOTING THE CALCULATED DATA


figure(1)
plot(x,y);
xlabel('x(mm)')
ylabel('y(mm)')
legend('X-Y Path')
grid on
axis([0 10000 -2.5e5 0])
figure(2)
plot(t,v_x,t,v_y,t,v)

xlabel('t(sec)')
ylabel('v_x,v_y,v(mmps)')
legend('v_x ,2v_y’,‘v')
grid on
figure(3)
plot(t,a_x,t,a_y,t,a)
xlabel('t(sec)')
ylabel('a_x,a_y,a(mmps^2)')
legend('a_x’,‘a_y’,‘a')
grid on

1
2
Published with MATLAB® R2021a

3
%Time Interval
t=0:0.05:1.5;
%Initial Velocity
v0=30;
%Function of Velocity
v=(1.4*t+1/v0^2).^-0.5;
%Function of distance
s=2/1.4*(sqrt(1.4*t+1/v0^2)-1/30);

figure(1)
plot(t,v);
xlabel('t(sec)')
ylabel('v(mps)')
grid on
figure(2)
plot(t,s)
xlabel('t(sec)')
ylabel('s(m)')
grid on

1
Published with MATLAB® R2021a

2
s=inline('5*t-3*t.^2');
v=inline('5-6*t');
a=inline('-6');
t=0:0.5:10;
figure(1);
subplot(3,1,1);
plot(t,s(t));
title('\bfDisplacement Plot');
ylabel('\bfDisplacement (m)');
grid on;
subplot(3,1,2);
plot(t,v(t));
title('\bfVelocity Plot');
ylabel('\bfVelocity (mps)');
grid on;
subplot(3,1,3); % SUB-PLOT-3
plot(t,a(t),'*');
title('\bfAcceleration Plot');
ylabel('\bfAcceleration (mps^2)');
grid on;

Published with MATLAB® R2021a

1
pi=3.14;
r =inline('1.75./(1-0.75*cos(3.14*t))');
rd=inline('-4.121*sin(3.14*t)./(1-0.75*cos(3.14*t)).^2');
rdd=inline('-19.4*sin(3.14*t).^2/(1-0.75*cos(3.14*t)).^3-12.94*cos(3.14*t)./(1-0.75*cos
theta=inline('3.14*t');
thetad=inline('3.14*t./t');
t=0.5:0.1:2;
vr=rd(t);vt=r(t).*theta(t);
ar=(rdd(t)-r(t).*thetad(t).^2);
at=2*rd(t).*thetad(t);
figure(1);
%VelTime
subplot(2,1,1);
plot(t,vr,t,vt,'-p');
title('\bfVelocity Plot');
ylabel('Velocity (m per s)');
legend('radial velocity','transverse velocity');
grid on;
%AccTime
subplot(2,1,2);
plot(t,ar,t,at,'-p');
title('\bfAcceleration Plot');
ylabel('Acceleration (mps^2)');
xlabel('Time in s');
legend('radial acceleration','transverse acceleration');
grid on;

You might also like