- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Piyush Kumar
2024-10-26,9:55
编辑:Piyush Kumar
2024-10-26,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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!