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]);
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!