draw_geom.m
来自「利用电磁场的源激发方法来计算光子晶体波导例如光子晶体光纤」· M 代码 · 共 56 行
M
56 行
function out = draw_geom(G, varargin)
% out = DRAW_GEOM(oGd, ...)
% Draws the geometry described by oGd. Scales the axes to show the whole
% geometry. Relables x and y axes.
% DRAW_GEOM(oGd, 'noaxischange') does not scale the axes.
% DRAW_GEOM(oGd, 'nolabel') does not relabel the axes.
% DRAW_GEOM(oGd, 'nothing') does neither.
global FontSize
fs = FontSize;
bAxesCh = 1;
bLabel = 1;
if nargin == 2
if strcmp(varargin{1}, 'nolabel')
bLabel = 0;
end
if strcmp(varargin{1}, 'noaxischange')
bAxesCh = 0;
end
if strcmp(varargin{1}, 'nothing')
bAxesCh = 0;
bLabel = 0;
end
end
nCurves = G.nSd-1;
fs = 15;
n = 100;
if bAxesCh
hold off
else
hold on
end
for iCurve = 1:nCurves
curve = G.curveArray(iCurve);
cs = curve.cs;
s = linspace(cs.breaks(1), cs.breaks(end) ,n);
mF = ppval(cs, s);
vSx = mF(1,:);
vSy = mF(2,:);
vSx = vSx+curve.xc;
vSy = vSy+curve.yc;
plot(vSx, vSy,'b', 'linewidth', 1)
hold on
% if bLabel
% fixfonts(text(curve.xc, curve.yc, '\epsilon_{r2}'), fs/1.2);
% end
end
fixfonts(gca, fs)
xlabel('x[m]')
ylabel('y[m]')
set(gca, 'ydir', 'normal')
if bAxesCh
axis equal
ax = axis;
axis(expand_axis(ax,1.2));
end
hold off
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?