i want to plot the vertical velocity graph in multiple location in cross section plan into the graph like the post image.

11 views (last 30 days)
this is the velocity data in every cross section. i dont understand how to draw in matlab?

Answers (1)

William Rose
William Rose on 6 Jun 2023
It would be helpful if you would provide some actual data and an explanation in words of what you want to plot.
It appears that you wish to plot velocities at varoius x,y, and z values. I will assume that the velocity is in the y-direction, since you plot it on the y-axis.
If you want a 3-D plot, use quiver3().
X = [2,2,2,2,2,2,2,2,2,8,8,8,8,8,8,8,8,8,20,20,20,20,20,20,20,20,20];
Z = [0,0,0,.4,.4,.4,.8,.8,.8,0,0,0,.4,.4,.4,.8,.8,.8,0,0,0,.4,.4,.4,.8,.8,.8];
Y = [-2,0,2,-2,0,2,-2,0,2,-2,0,2,-2,0,2,-2,0,2,-2,0,2,-2,0,2,-2,0,2];
disp([size(X),size(Y),size(Z),size(X-12),size(Z+.8),size(5-Y.^2)])
1 27 1 27 1 27 1 27 1 27 1 27
U = zeros(1,27);
V = (Z+.8).*(X+12).*(5-Y.^2);
W = zeros(1,27);
quiver3(X,Y,Z,U,V,W);
xlabel('X'), ylabel('Y'), zlabel('Z')
That example does not look great due to the sparsity of arrows, but you can try it.
If you want a plot more like the image you shared, make three plots with quiver(), which is the 2D version.
Good luck with your work.
  1 Comment
William Rose
William Rose on 6 Jun 2023
Here's another example of using quiver3 and quiver.
x=[2,8,20]; y=[-2:.4:2]; z=[.1:.1:.9];
[X,Y,Z]=meshgrid(x,y,z);
U=zeros(size(X)); W=zeros(size(X));
V=(X-9).*(.2-(Z-.5).^2).*(5-Y.^2);
quiver3(X,Y,Z,U,V,W);
xlabel('X'), ylabel('Y'), zlabel('Z'); title('Velocity')
Or make three 2-D plots:
figure;
subplot(311);
quiver(squeeze(Y(:,3,:)),squeeze(Z(:,3,:)),squeeze(V(:,3,:)),squeeze(W(:,3,:)))
xlabel('Y'); ylabel('Z'); title('X=20');
subplot(312);
quiver(squeeze(Y(:,2,:)),squeeze(Z(:,2,:)),squeeze(V(:,2,:)),squeeze(W(:,2,:)))
xlabel('Y'); ylabel('Z'); title('X=8');
subplot(313);
quiver(squeeze(Y(:,1,:)),squeeze(Z(:,1,:)),squeeze(V(:,1,:)),squeeze(W(:,1,:)))
xlabel('Y'); ylabel('Z'); title('X=2');
A problem with the three plots above is that the length of the arrows is auto-scaled independently on each subplot, so the differences in velocities across plots are not apparent. Another problem is that the horizontal axis ranges are different in different subplots. Therefore turn off autoscaling, and set the horizontal axis limits manually for each subplot:
figure;
V=V/25; % rescale the y-axis velocities for plotting
subplot(311);
quiver(squeeze(Y(:,3,:)),squeeze(Z(:,3,:)),squeeze(V(:,3,:)),squeeze(W(:,3,:)),'AutoScale',0)
xlabel('Y'); ylabel('Z'); title('X=20'); xlim([-2.5,2.5])
subplot(312);
quiver(squeeze(Y(:,2,:)),squeeze(Z(:,2,:)),squeeze(V(:,2,:)),squeeze(W(:,2,:)),'AutoScale',0)
xlabel('Y'); ylabel('Z'); title('X=8'); xlim([-2.5,2.5])
subplot(313);
quiver(squeeze(Y(:,1,:)),squeeze(Z(:,1,:)),squeeze(V(:,1,:)),squeeze(W(:,1,:)),'AutoScale',0)
xlabel('Y'); ylabel('Z'); title('X=2'); xlim([-2.5,2.5])
Good luck.

Sign in to comment.

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!