Plot the trajectory of vectors in MATLAB -
i have created following data in matlab example, using x , y axes:
t = 1:5 % time in seconds dxx = [10,8,6,5,4] % speed in x direction w = trapz(t,dxx) % distance object in x direction (numerical integration) dyy = [9,7,6,5,3] % speed in y direction c = trapz(t,dyy) % distance of object in y direction (numerical integration)
how can plot vectors dxx(t) vs dyy(t) (the net trajectory @ time t), using data?
first assume need cumtrapz
instead of trapz
. plotting can use quiver
t = 1:5 % time in seconds dxx = [10,8,6,5,4] % speed in x direction w = cumtrapz(t,dxx) % distance object in x direction (numerical integration) dyy = [9,7,6,5,3] % speed in y direction c = cumtrapz(t,dyy) % distance of object in y direction (numerical integration) quiver(w,c,dxx,dyy)
resulting in:
is looking for?
Comments
Post a Comment