How to plot specific velocity contour in matlab from fluent data

조회 수: 5 (최근 30일)
Kaleemullah Mohammed
Kaleemullah Mohammed 2022년 9월 27일
답변: Vinayak 2023년 8월 29일
Hi,
I have my velocity(x and y) exported from fluent and I am trying to plot them in matlab.When I plot them I am getting contours outside of my domain. How can I get the contours only inside of my domain and the rest is white. Also how do I plot or contour specific values of velocity. Say for example I want to plot only the negative values of the velocity in the flow field using surf command.

답변 (1개)

Vinayak
Vinayak 2023년 8월 29일
Hi,
We can achieve this by setting he values of velocity that are greater than or equal to zero to NaN using logical indexing. Then, we use surf to plot the surface of the velocity data.
I have attached a sample code snippet below:-
% Example velocity data
x = linspace(-10, 10, 100); % x coordinates
y = linspace(-10, 10, 100); % y coordinates
[X, Y] = meshgrid(x, y); % Create a meshgrid
velocity = X + Y; % Example velocity data (replace with your actual data)
% Set negative values to NaN
velocity(velocity >= 0) = NaN;
% Plot the surface
surf(X, Y, velocity);
% Add labels and title
xlabel('X');
ylabel('Y');
zlabel('Velocity');
title('Negative Velocity');
% Show the plot
Thanks,
Vinayak

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by