Plotting a vectorial function over a meshgrid.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear MathWorks Community, I would like to plot a vectorial function called mysurface over a 2D area like [0,2]x[0,1]. Basically the function describes a deformation of [0,2]x[0,1] into 3D. When defining a meshgrid [X,Y] = meshgrid(0:0.1:2, 0:0.1:1) I can't simply write mysurface([X,Y]), since [X,Y] isn't a vector. How do I handle that? Also I would like to plot the resulting surface, but using surface[X,Y,Z] wouldn't make sense. I need something like p=mysurface([X,Y]) and plot with surface(p(1),p(2),p(3)) but over all points of the grid. Thank you in advance.
7 Kommentare
Guillaume
am 24 Okt. 2018
It sounds like your input was actually a 3D mesh with all points having Z=0 and your output was the resulting 3D mesh after deformation and you're just plotting that resulting 3D mesh.
In which case, yes it's fairly straightforward. However, I don't understand how summing the X and Y coordinates of the input mesh helps.
Please don't close questions that have an answer. Even if the answer is not what you were looking for.
Philipp Tscherner
am 24 Okt. 2018
Bearbeitet: Philipp Tscherner
am 24 Okt. 2018
Antworten (1)
KSSV
am 24 Okt. 2018
V = [2 3] ;
L = V(1) ; % length of the plate
B = V(2) ; % breadth of the plate
N = 100 ;
x = linspace(0,L,N) ;
y = linspace(0,B,N) ;
[X,Y] = meshgrid(x,y) ;
mesh(X,Y)
0 Kommentare
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!
