필터 지우기
필터 지우기

how to display a direction vector in matlab

조회 수: 29 (최근 30일)
maryam
maryam 2014년 9월 19일
답변: Star Strider 2014년 9월 19일
I am trying to demonstrate some velocity data with their direction, basically want to combine velocity and direction in MATLAB. I would like to show the changes in velocity and direction in time. I was wondering if there is any function for that?
Thanks, Maryam

답변 (3개)

Star Strider
Star Strider 2014년 9월 19일
Not certain exactly what you want to do, but see if this gets you started:
v = linspace(0.01, 0.1, 10); % Velocity
a = linspace(-90, 90, 10); % Angle (degrees)
x = v.*cosd(a); % Create ‘x’ Coordinate
y = v.*sind(a); % Create ‘y’ Coordinate
dx = gradient(x); % Create x-Direction Vector
dy = gradient(y); % Create y-Direction Vector
figure(1)
quiver(x, y, dx, dy)
grid
I used degrees for the angles, and so sind and cosd. If you use radian measure, use sin and cos.

José-Luis
José-Luis 2014년 9월 19일
doc quiver
doc feather

maryam
maryam 2014년 9월 19일
Thanks José-Luis. As I know quiver and feather are useful whenever we have u,v and we want velocity vector. In my case, I have magnitude of velocities and angels which I want to show on a parametric curve. I am not sure if I can do it with these commands.

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by