How to plot specific velocity contour in matlab from fluent data

5 次查看(过去 30 天)
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 中查找有关 Audio I/O and Waveform Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by