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

4 ビュー (過去 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 Center および File ExchangeData Exploration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by