Clear Filters
Clear Filters

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

5 views (last 30 days)
%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)

Answers (1)

KSSV
KSSV on 2 Jun 2017
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 Comments
mehmet baki
mehmet baki on 2 Jun 2017
Edited: mehmet baki on 2 Jun 2017
ı 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

Sign in to comment.

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!