How to plot specific velocity contour in matlab from fluent data
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
2 Kommentare
Antworten (1)
Vinayak
am 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu General Physics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!