I want a Matlab Program for creating a single frame with combined plots of a surface plot of a two-dimensional standing wave field in addition to an image of projection plot

2 次查看(过去 30 天)
I want to a write Matlab Program for creating a single frame with combined plots of a surface plot of a two-dimensional standing wave field in addition to an image of projection plot below the surface a distance apart along the Z axis and using same X, Y axes. What I want is similar to the 6th figure ( https://www.mathworks.com/help/matlab/ref/imagesc.html ). But I am unable to produce such plot.
Here is my code:
x = linspace(-1, 1, 100); y = linspace(-1, 1, 100); [X, Y] = meshgrid(x, y);
frequency = 1; amplitude = 1;
Z = amplitude * sin(2 * pi * frequency * X) .* sin(2 * pi * frequency * Y);
surf(X, Y, Z); hold on;
distanceApart = 2; Z_projection = Z - distanceApart;
imagesc(X, Y, Z_projection); title('Combined Plot: Surface and Projection Below the Surface'); xlabel('X-axis'); ylabel('Y-axis'); colorbar;
set(gcf, 'Position', [100, 100, 800, 500]);

采纳的回答

Matt J
Matt J 2024-2-1
编辑:Matt J 2024-2-1
x = linspace(-1, 1, 100); y = linspace(-1, 1, 100); [X, Y] = meshgrid(x, y);
frequency = 1; amplitude = 1;
Z = amplitude * sin(2 * pi * frequency * X) .* sin(2 * pi * frequency * Y);
surf(X, Y, Z);
hold on
distanceApart = 2;
t=hgtransform('Parent',gca(),'Matrix',eye(4));
t.Matrix(15)=-distanceApart;
im=imagesc(x,y, Z,'Parent',t);
title('Combined Plot: Surface and Projection Below the Surface');
xlabel('X-axis'); ylabel('Y-axis'); colorbar;
set(gcf, 'Position', [100, 100, 800, 500]);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by