You are on page 1of 1

clear all;

PI = 3.14159;
g = 9.80655;

%theta = input('enter the angle [deg]: ');


%l = input('enter the length [m]: ');
theta = 30; % [deg]
l = 2; % [m]
V_0 = 0; % initial condition

sim('inclined_plane_sim');

disp('trajectory drawing');
figure;
hold on;
grid on;
plot(x,y);
axis([0 l 0 l])
xlabel('x');
ylabel('y');
title('block on an inclined plane - trajectory');

disp('time at the end of inclined plane: ');


disp([num2str(t(end)),' s']);
disp('velocity at the end of inclined plane: ');
disp([num2str(V(end)),' m/s']);
disp('acceleration at the end of inclined plane: ');
disp([num2str(a(end)),' m/s^2']);

%% visualization
q=100;
x = linspace(x(1),x(end),q);
y = linspace(y(1),y(end),q);
t = linspace(t(1),t(end),q);

figure; hold on;


for i=1:q-1
clf;
plot(x(i),y(i),'r.','MarkerSize',20); hold on;
plot(x+0.01,y,'k','LineWidth',1); hold on;
axis([0 l 0 l]);
pause(t(i+1)-t(i));
end

You might also like