编辑Matlab`ezmesh`属性

时间:2014-01-30 18:28:34

标签: matlab matlab-figure

我正在尝试绘制一个表面,并且它的线框具有不同的属性。首先我使用ezsurf,我认为最重要的是我可以使用ezmesh。但是,看起来ezmesh有白色FaceColor并且不透明。我试图改变那个属性,但我还没有成功。这是我的工作范例。

那么,如何编辑ezmesh的属性?

clc;clear all; close all;
pmin=-.25*pi;
pmax=1.25*pi;
syms x t
%---Surface---%
figure(1)
n=60;
colormap([.95 .95 .95])
hold on
ezsurf((x-2)*cos(t),(x-2)*sin(t),x,[pmin,pmax,-.75,1],n)
ezsurf((x-2)*cos(t),(x-2)*sin(t),-x,[pmin,pmax,-.75,1],n)
ezsurf((-sqrt(1-x.^2)-3.41)*cos(t),(-sqrt(1-x.^2)-3.41)*sin(t),x,[pmin,pmax,-1,1],n)
ezsurf((sqrt(1-x.^2)-3.41)*cos(t),(sqrt(1-x.^2)-3.41)*sin(t),x,[pmin,pmax,0.75,1],n)
ezsurf((sqrt(1-x.^2)-3.41)*cos(t),(sqrt(1-x.^2)-3.41)*sin(t),x,[pmin,pmax,-1,-0.75],n)
shading interp
view(185,10)
axis equal
h=light('Position',[0 10 0])
%----------------%

%---Wireframe---%
%I'd like something as follows
%set(FromNowOn,'FaceColor','none','EdgeColor','k')
n=10;
ezmesh((x-2)*cos(t),(x-2)*sin(t),x,[pmin,pmax,-.75,1],n)
ezmesh((x-2)*cos(t),(x-2)*sin(t),-x,[pmin,pmax,-.75,1],n)
ezmesh((-sqrt(1-x.^2)-3.41)*cos(t),(-sqrt(1-x.^2)-3.41)*sin(t),x,[pmin,pmax,-1,1],n)
ezmesh((sqrt(1-x.^2)-3.41)*cos(t),(sqrt(1-x.^2)-3.41)*sin(t),x,[pmin,pmax,0.75,1],n)
ezmesh((sqrt(1-x.^2)-3.41)*cos(t),(sqrt(1-x.^2)-3.41)*sin(t),x,[pmin,pmax],[-1,-0.75],n)
%--------------%

1 个答案:

答案 0 :(得分:0)

解决方案不要使用ezmeshezsurf!生活很美好。

enter image description here

clc;clear all; close all;
pmin=-.25*pi;
pmax=1.25*pi;
%---Surface---%
figure(1)
colormap([.65 .65 .65])
hold on
[x,t]=meshgrid(-.75:0.01:1,pmin:.1:pmax);
surf((x-2).*cos(t),(x-2).*sin(t),x)
surf((x-2).*cos(t),(x-2).*sin(t),-x)
[x,t]=meshgrid(-1:0.01:1,pmin:.1:pmax);
surf((-sqrt(1-x.^2)-3.41).*cos(t),(-sqrt(1-x.^2)-3.41).*sin(t),x)
[x,t]=meshgrid(.75:0.01:1,pmin:.1:pmax);
surf((sqrt(1-x.^2)-3.41).*cos(t),(sqrt(1-x.^2)-3.41).*sin(t),x)
[x,t]=meshgrid(-1:0.01:-.75,pmin:.1:pmax);
surf((sqrt(1-x.^2)-3.41).*cos(t),(sqrt(1-x.^2)-3.41).*sin(t),x)
shading interp
view(185,10)
axis equal
h=light('Position',[0 10 0])
%---------------------%

%-- Wireframe---%
[x,t]=meshgrid(-.75:0.25:1,pmin:.1:pmax);
mesh((x-2).*cos(t),(x-2).*sin(t),x,'Edgecolor','k','FaceColor','none')
mesh((x-2).*cos(t),(x-2).*sin(t),-x,'Edgecolor','k','FaceColor','none')
[x,t]=meshgrid(-1:0.1:1,pmin:.1:pmax);
mesh((-sqrt(1-x.^2)-3.41).*cos(t),(-sqrt(1-x.^2)-3.41).*sin(t),x,'Edgecolor','k','FaceColor','none')
[x,t]=meshgrid(.75:0.05:1,pmin:.1:pmax);
mesh((sqrt(1-x.^2)-3.41).*cos(t),(sqrt(1-x.^2)-3.41).*sin(t),x,'Edgecolor','k','FaceColor','none')
[x,t]=meshgrid(-1:0.05:-.75,pmin:.1:pmax);
mesh((sqrt(1-x.^2)-3.41).*cos(t),(sqrt(1-x.^2)-3.41).*sin(t),x,'Edgecolor','k','FaceColor','none')

%---------------%