How to plot specific velocity contour in matlab from fluent data

6 views (last 30 days)
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.

Answers (1)

Vinayak
Vinayak on 29 Aug 2023
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

Categories

Find more on General Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!