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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by