필터 지우기
필터 지우기

How to shift a fsurf plot?

조회 수: 1 (최근 30일)
Stephan
Stephan 2018년 5월 22일
댓글: Stephan 2018년 5월 22일
Hello,
I would like to shift the plot produced by
openExample('graphics/ParameterizedSurfacePlotExample')
with respect to the x,y-axis. My ansatz is
r = @(u,v) 2 + sin(7.*u + 5.*v);
funx = @(u,v) r(u,v).*cos(u).*sin(v);
funy = @(u,v) r(u,v).*sin(u).*sin(v);
funz = @(u,v) r(u,v).*cos(v);
% fsurf(funx,funy,funz,[0 2*pi 0 pi]); % This plot should be shifted
xshift = 2; yshift = -2;
fsurf( @(u,v)funx(u-xshift,v-yshift), @(u,v)funy(u-xshift,v-yshift), @(u,v)funz(u-xshift,v-yshift), [0 2*pi 0 pi])
However, this does not work.
Thanks for any help!

채택된 답변

KSSV
KSSV 2018년 5월 22일
r = @(u,v) 2 + sin(7.*u + 5.*v);
funx = @(u,v) r(u,v).*cos(u).*sin(v);
funy = @(u,v) r(u,v).*sin(u).*sin(v);
funz = @(u,v) r(u,v).*cos(v);
% fsurf(funx,funy,funz,[0 2*pi 0 pi]); % This plot should be shifted
xshift = 2; yshift = -2;
% fsurf( @(u,v)funx(u-xshift,v-yshift), @(u,v)funy(u-xshift,v-yshift), @(u,v)funz(u-xshift,v-yshift), [0 2*pi 0 pi])
M = 100 ; N =100 ;
u = linspace(0,2*pi,M) ;
v = linspace(0,pi,N) ;
[U,V] = meshgrid(u,v) ;
X = funx(U,V)-2 ;
Y = funy(U,V)+2 ;
Z = funz(U,V) ;
surf(X,Y,Z)
  댓글 수: 1
Stephan
Stephan 2018년 5월 22일
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by