Plot a Surface on a circle and annulus

15 ビュー (過去 30 日間)
Delia Panca
Delia Panca 2017 年 1 月 12 日
回答済み: Roger Stafford 2017 年 1 月 13 日
Hello. I need to plot a surface given by the form z=f(x,y) more specifically z=x^2-y^2 on a circle centered in the origin and radius 2 and on an annulus with given radius 1<=r<=3. Can someone help me with this please?

回答 (1 件)

Roger Stafford
Roger Stafford 2017 年 1 月 13 日
For the circle (disk) do this:
[T,R] = meshgrid(linspace(0,2*pi,64),linspace(0,2,16));
X = R.*cos(T);
Y = R.*sin(T);
Z = X.^2-Y.^2;
surf(X,Y,Z)
For the annulus, change first line to:
[T,R] = meshgrid(linspace(0,2*pi,64),linspace(1,3,16));

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by