I need help to graph particle's (3D) and declare x,y,z functions of time describing the particle's path, and calculate position ,velocity and acceleration by matlab and simulink, which commands do ı have to use? thanks

4 次查看(过去 30 天)
%position vector r=xi+yj+zk
%velocity vector v
%acceleration vector a
t=0:.5:10;
x=2*cos(t);
y=1.3+2.7*t.^2-.031*t.^3;
z=2.4+.14*t.^3;
figure;
plot(x,y,z,t)

回答(1 个)

KSSV
KSSV 2017-6-2
t=0:.5:10;
%%position
x=2*cos(t);
y=1.3+2.7*t.^2-.031*t.^3;
z=2.4+.14*t.^3;
figure;
hold on
plot3(x,y,z,'r')
%%velocity
dt = unique(diff(t)) ;
dx = diff(x)/dt ;
dy = diff(y)/dt ;
dz = diff(z)/dt ;
plot3(dx,dy,dz,'b') ;
%%acceleration
ddx = diff(dx)/dt ;
ddy = diff(dy)/dt ;
ddz = diff(dz)/dt ;
plot3(ddx,ddy,ddz,'g') ;
legend({'position','velocity','acceleration'})
  2 个评论
mehmet baki
mehmet baki 2017-6-2
编辑:mehmet baki 2017-6-2
ı just want to graph particle's 3D path and write x,y,z, terms as (for exam. r=3i+5j+10k )
  • a position vec. r=xi+yj+zk & magnitude
  • a velocity vec. v=..i+..j+..k & magnitude
  • a acceleration vec. a=..i+..j..+..k & magnitude
both matlab and simulink solution is necessary

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Function Creation 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by