Plotting displacement field vector using quiver
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have two displacement arrays x and y. How to plot displacement field using quiver option. Following is the code which I have used. I am not sure whether the code is correct.
x1=load('DISP_X.xvg'); y1=load('DISP_Y.xvg'); [X,Y]=meshgrid(x1,y1); quiver(X,Y)
Please help me. Thanks in advance.
0 comentarios
Respuestas (1)
Jaswanth
el 17 de Oct. de 2024
Hi,
To plot a displacement field using the “quiver” function in MATLAB, you need to ensure that your displacement arrays ‘x1’ and ‘y1’ are correctly structured. The “quiver” function requires two sets of data: the grid points where vectors are anchored, and the vector components in the x and y directions.
Assuming the data in your ‘. xvg’ files is correctly formatted and corresponds to the expected dimensions when loaded into MATLAB, Use “meshgrid” to create a grid where the vectors will be anchored.
% Assuming x1 and y1 are vectors. If they are matrices, skip meshgrid
[X, Y] = meshgrid(1:size(x1, 2), 1:size(y1, 1));
Now, Use the “quiver” function to plot the vectors.
% Plot the displacement field
quiver(X, Y, x1, y1);
I hope the solution provided above is helpful.
0 comentarios
Ver también
Categorías
Más información sobre Vector Fields en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!