문제

I have created the following data in MATLAB as an example, using the x and 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 I plot the vectors dxx(t) vs dyy(t) (the net trajectory at time t), using only this data?

도움이 되었습니까?

해결책

First I assume you need cumtrapz instead of trapz. For plotting you 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:

enter image description here

Is it what you are looking for?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top