clc
clear
disp"Zhoria Renfus"
t= 0:0.01:10;
XA= 0.6 .*t;
XB= 0.05 .*t.^2 + 0.1 +0.5;
plot(t,XA, 'b', 'linewidth',2);
plot(t, XB,'r', 'linewidth',2);
xlabel('Time (s)')
ylabel('Position(m)')
title('Position vs. Time for Cart A and Cart B')
legend('Cart A', 'Cart B')
t1= 5 - sqrt(15)
t2= 5+ sqrt(15)
x1= 0.6 * t1
x2=0.6 * t2
fprintf('First meeting: t = %.2f s, x = %.2f m\n', t1, x1)
fprintf('Second meeting: t = %.2f s, x = %.2f m\n', t2, x2)
To embed this project on your website, copy the following code and paste it into your website's HTML: