- Collect the x,y,z points
- Use the surf function to create the 3D plot
- Set colormap
- Use "hold on" to add inset plot in the same figure
- Add labels for the plot
- Create inset plot
- Set axis limit and aspect ratio
how i can change my color of picture i want yellow one?
30 views (last 30 days)
Show older comments
How i get this one can any one give me some idea or if have example form it will be so good ?
I already have this but i want other type of plot like above or even better if exist
0 Comments
Answers (1)
Piyush Kumar
on 26 Oct 2024 at 9:55
Edited: Piyush Kumar
on 26 Oct 2024 at 9:56
To plot a figure you have shared, you would need the function that is plotted. There is an inset plot in the figure too.
You can follow these steps -
Suppose you want to plot ,
% Define x,y,z points
[x, y] = meshgrid(linspace(-20, 20, 100), linspace(-20, 20, 100));
z = sin(sqrt(x.^2 + y.^2)) ./ sqrt(x.^2 + y.^2);
% Create the 3D surface plot
figure;
surf(x, y, z, 'EdgeColor', 'none');
colormap(jet);
hold on;
% Add a plane
planeZ = zeros(size(x));
surf(x, y, planeZ, 'FaceColor', 'yellow', 'EdgeColor', 'none', 'FaceAlpha', 0.5);
% Set labels
xlabel('x');
ylabel('y');
zlabel('u(x,y)');
% Create inset plot
axes('Position', [0.7, 0.7, 0.2, 0.2]);
plot(x(1, :), z(50, :), 'k', 'LineWidth', 1.5);
xlabel('x');
ylabel('u(x)');
title('Inset');
% Adjust view
view(3);
axis tight;
0 Comments
See Also
Categories
Find more on Polar Plots 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!