How I can plot surface countour plot and velocity plot on same garph using MATLAB
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
How I can plot surface countour plot and velocity plot on same garph using MATLAB
0 comentarios
Respuestas (1)
ag
el 30 de En. de 2025
Hi Sharad,
This can be achieved by using the "hold" feature of MATLAB. The below code demonstrates how to do the same:
% Generate example data for the surface
[X, Y] = meshgrid(-2:0.1:2, -2:0.1:2);
Z = X .* exp(-X.^2 - Y.^2);
% Generate example data for the velocity field
[U, V] = gradient(Z);
% Create the contour plot
figure;
contourf(X, Y, Z, 20); % 20 specifies the number of contour levels
colormap(jet); % Select a colormap
colorbar; % Display the colorbar
hold on; % Retain current plots to add more
% Overlay the velocity field
quiver(X, Y, U, V, 'k'); % 'k' denotes black arrows
% Add labels and a title
xlabel('X-axis');
ylabel('Y-axis');
title('Surface Contour Plot with Velocity Field');
% Adjust axis limits if necessary
axis tight;
hold off;
For more details, please refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/hold.html
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!