Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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]);

Respuesta aceptada

Matt J
Matt J el 1 de Feb. de 2024
Editada: Matt J el 1 de Feb. de 2024
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]);

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by