Hello guys! I need a little help with 3d plotting. I need to do the coloring for the surface like this, but I cant get the yellowy parts to their correct positions.
조회 수: 2(최근 30일)
This is what I have done so far (first is the function calling code, it wasnt made by me, only the function):
[X, Y] = meshgrid(x,y);
Z = 2*(peaks(X, Y)-3);
[C,U,V,W,fig1,plt1,plt2,fig2,plt3,cl] = tengerpart(X,Y,Z)
function [C,U,V,W,fig1,plt1,plt2,fig2,plt3,cl] = tengerpart(X,Y,Z)
[U, V, W]=surfnorm(X, Y, Z);
plt1=surf(X, Y, Z, C);
plt2=quiver3(X, Y, Z, U, V, W, 'r');
Daniel Vieira 2022년 4월 13일
ok... what do you mean by "correct position" for the yellow parts? where is the correct?
strange things I noticed:
1) the "U=U; V=V; W=W" part means nothing, you can take that out.
2) when you do "C=gradient(Z);" you only get the x-component of the gradient, was that really your intention? to get both you shoud do "[Cx,Cy]=gradient(Z);".