drawing a quiver for a list of 1D arrows

14 次查看(过去 30 天)
Assuming we have a set of points x and y positions. Something like: x = [1.25 1.4 1.45 1.6] y = [6 6.15 6.2 6.35] and the velocity values at them in 1D direction: vel = [-0.0145 -0.0231 -0.0134] How can we show the quiver arrows in 2D plane according to their positions and directions in this 1D line ?? Something like 3 arrows in the plane in this case for example ??

回答(2 个)

Ced
Ced 2016-4-20
Hi
What do you mean by "velocity values in 1D direction"? Your velocity has 3 components. Regardless, you can plot any of these things using quiver, or quiver3. Example:
x = [1.25 1.4 1.45 1.6]';
y = [6 6.15 6.2 6.35]';
z = [ 0 0 0 0 ]';
vel = [-0.0145 -0.0231 -0.0134];
N = length(x);
vel_mat = repmat(vel,N,1);
% draw 3D quiver plot
quiver3(x,y,z,vel_mat(:,1),vel_mat(:,2),vel_mat(:,3))
xlabel('x')
ylabel('y')
zlabel('z')
% select view (here, x-y)
view(0,90)
returns

Sahar Amir
Sahar Amir 2016-4-20
You are right we can define it as you said or using the quiver to look like what you showed ... However, it is different than what I want. I mean that we have a line defined by the x y positions we defined above. Now we want to draw the velocity lines within this line (inside of it). So, they are supposed to look like a line of arrows within this line and each arrow size differes according to the velocity at that point. All of this will be combined within a bigger figure but for now lets focus on this part.
  1 个评论
Ced
Ced 2016-4-20
You would do that exactly like above, you just have to set your velocity accordingly. Let's say you have a speed s1 at point (x(1),y(1)) towards (x(2),y(2)), then
dx = diff(x);
dy = diff(y);
vel = s1*[ dx(1) ; dy(1) ; 0 ]/sqrt(dx(1).^2 + dy(1).^2);
?

请先登录,再进行评论。

类别

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