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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pradipta Panchadhyayee
am 31 Jan. 2024
Kommentiert: Pradipta Panchadhyayee
am 1 Feb. 2024
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 Kommentare
Akzeptierte Antwort
Matt J
am 1 Feb. 2024
Bearbeitet: Matt J
am 1 Feb. 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]);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!