Display Matlab 3D matrix in ParaView

조회 수: 24 (최근 30일)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2023년 1월 19일
답변: Gayatri Rathod 2023년 3월 2일
Hi all,
I have the velocity field of a glacier which I can plot in Matlab (file in attachment). I am however struggling to visualize the same matrix in ParaView in a similar manner as done with Matlab. Can somebody help me with a step-by-step process?
Thanks!
clear all
close all
diff = load('3d_velocity.mat');
diff = diff.diff;
realx = 0:25:(size(diff, 2)-1)*25;
realy = (0:25:(size(diff, 1)-1)*25)';
zeta = linspace(1, 0, size(diff, 3))';
realz = zeta*120;
h = slice(realx,realy,realz,diff, [], [], 1:size(diff,1));
set(h, 'EdgeColor','none', 'FaceColor','interp', 'FaceLighting','gouraud')
colormap(turbo)
shading interp
daspect([0.5 1 .2])
view(-148,25)
set(gcf, 'color', 'white')
xlim([1400 2700])
ylim([0 5500])
zlim([0 200])
ylabel('Distance y (m)')
xlabel('Distance x (m)')
zlabel('Height z (m)')

채택된 답변

Gayatri Rathod
Gayatri Rathod 2023년 3월 2일
Hi Yoni,
To visualize the velocity field in ParaView, you can follow these steps:
  • Open ParaView and load the velocity field data file. To load the data file, go to File -> Open and select the data file. In the dialog box that appears, select the file format as "Generic ASCII" and click on "Add File Series" if the data is in multiple files.
  • Once the data is loaded, you should see it in the "Pipeline Browser" on the left-hand side of the ParaView window. Click on the "Apply" button to load the data into the 3D view.
  • To visualize the velocity field, you need to change the data representation to a vector field. To do this, click on the "Display" button in the "Properties" panel on the right-hand side of the ParaView window. In the "Display" panel, change the "Representation" to "Glyphs" and select "Glyph Type" as "Arrow".
  • Now specify the vector field for ParaView to use. In the "Glyph" panel, set the "Vectors" property to the name of the velocity field variable in your data file. You can find the variable name in the data file or by looking at the "Information" panel in the "Pipeline Browser".
  • To make the visualization clearer, you can filter the data using the "Clip" tool. To do this, click on the "Filters" button in the "Pipeline Browser" and select "Clip". In the "Clip" panel, set the "Clip Type" to "Box" and adjust the box size and position as needed to focus on the area of interest.
  • You can adjust the visualization settings such as the colour map, lighting, and camera view to make the visualization look more like the MATLAB plot. To do this, use the "Properties" panel and the "Display" panel as needed.
  • Once you are happy with the visualization, you can save it as an image or animation by clicking on the "File" menu and choosing "Save screenshot" or "Save animation".
You can read more about the ParaView from the following documentations: paraView Documentation, Intro to ParaView.
Hope it helps!
Regards,
Gayatri Rathod

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by