Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

function[]=QDARt1()

syms t c
y=input('y=');
x=input('x=');
t1=0;t2=5;t0=1;
dx=diff(x);dy=diff(y);d2x=diff(dx);d2y=diff(dy);
V=subs(sqrt(dx^2 +dy^2),t,t0);
fprintf('Van toc cua vat:\n(+)Tai vi tri t= %f:%f (m/s)\n',t0,V);
a=subs(sqrt(d2x^2 +d2y^2),t,t0);
fprintf('Gia toc cua vat:\n(+)Tai vi tri t= %f:%f (m/s^2)\n',t0,a);
R=abs(((dx^2 +dy^2)^(1.5))/(dx*d2y-dy*d2x));
Rt0=subs(R,t0);
fprintf('[-]Ban kinh cong cua vat:\n(+)Tai vi tri t= %f:%f (m)\n',t0,Rt0);
X=t1:0.01:t2+1;
subplot(2,2,1);
plot(subs(x,X),subs(y,X));
hold on
title('Quy dao vat y(x)');
grid on
xlabel('x');ylabel('y');
plot(subs(x,t0),subs(y,t0),'rd');
subplot(2,2,2);
plot(X,subs(y,X));
hold on
title('y(t)');
grid on
xlabel('t');ylabel('y');
plot(t0,subs(y,t0),'rd');
subplot(2,2,3);
plot(X,subs(x,X));
hold on
title('x(t)');
grid on
xlabel('t');ylabel('x');
plot(t0,subs(x,t0),'rd');
end

You might also like