필터 지우기
필터 지우기

How can I plot f(x,y) in xy plane

조회 수: 3 (최근 30일)
M
M 2022년 6월 10일
댓글: M 2022년 6월 10일
Hi, Would you mind telling me how can I plot two figures in this "LINK" in matlab?
particularly in this range: x,y=[0,5]

채택된 답변

John D'Errico
John D'Errico 2022년 6월 10일
help fsurf
FSURF Plot 3-D surface FSURF(FUN) creates a surface plot of the function FUN(X,Y). FUN is plotted over the axes size, with a default interval of -5 < X < 5, -5 < Y < 5. FSURF(FUN,INTERVAL) plots FUN over the specified INTERVAL instead of the default interval. INTERVAL can be the vector [XMIN,XMAX,YMIN,YMAX] or the vector [A,B] (to plot over A < X < B, A < Y < B). FSURF(FUNX,FUNY,FUNZ) plots the parametric surface FUNX(U,V), FUNY(U,V), and FUNZ(U,V) over the interval -5 < U < 5 and -5 < V < 5. FSURF(FUNX,FUNY,FUNZ,[UMIN,UMAX,VMIN,VMAX]) or FSURF(FUNX,FUNY,FUNZ,[A,B]) uses the specified interval. FSURF(AX,...) plots into the axes AX instead of the current axes. H = FSURF(...) returns a handle to the surface object in H. Examples: fsurf(@(x,y) x.*exp(-x.^2-y.^2)) fsurf(@(x,y) besselj(1,hypot(x,y))) fsurf(@(x,y) besselj(1,hypot(x,y)),[-20,20]) % this can take a moment fsurf(@(x,y) sqrt(1-x.^2-y.^2),[-1.1,1.1]) fsurf(@(x,y) x./y+y./x) fsurf(@peaks) f = @(u) 1./(1+u.^2); fsurf(@(u,v) u, @(u,v) f(u).*sin(v), @(u,v) f(u).*cos(v),[-2 2 -pi pi]) A = 2/3; B = sqrt(2); xfcn = @(u,v) A*(cos(u).*cos(2*v) + B*sin(u).*cos(v)).*cos(u) ./ (B - sin(2*u).*sin(3*v)); yfcn = @(u,v) A*(cos(u).*sin(2*v) - B*sin(u).*sin(v)).*cos(u) ./ (B - sin(2*u).*sin(3*v)); zfcn = @(u,v) B*cos(u).^2 ./ (B - sin(2*u).*sin(3*v)); h = fsurf(xfcn,yfcn,zfcn,[0 pi 0 pi]); If your function has additional parameters, for example k in myfun: %------------------------------% function z = myfun(x,y,k1,k2,k3) z = x.*(y.^k1)./(x.^k2 + y.^k3); %------------------------------% then you may use an anonymous function to specify that parameter: fsurf(@(x,y)myfun(x,y,2,2,4)) See also FPLOT, FPLOT3, FMESH, FIMPLICIT3, SURF, VECTORIZE, FUNCTION_HANDLE. Documentation for fsurf doc fsurf
  댓글 수: 1
M
M 2022년 6월 10일
Thanks for quick response.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by