📄 drawdel.m
字号:
function dr = drawdel(c,d,f,t,n,p,s,F,dc)
% drawdel(c,d,f,t,n,p,s,F)
% c = x1
% d = y1
% f = x2 or y2
% t = text "D"
% n = exponent z^(-n)
% p = orientation:
% input ->-D--- output
% 0 = left ->-D--- right
% 1 = down ->-D--- up
% 2 = right ->-D--- left
% 3 = up ->-D--- down
% ...
% 14 = left ->-D->- right
% 15 = down ->-D->- up
% 12 = right ->-D->- left
% 11 = up ->-D->- down
% s = scale
% F = font size
% dc= draw color
% ----------------
% drawdel.m Draw DELAY
% 7:53PM 9/18/99
%
% Drawing Filter Realizations
%
% Authors: Miroslav D. Lutovac, Dejan V. Tosic, 1999.08.21
% lutovac@galeb.etf.bg.ac.yu
% tosic@telekom.etf.bg.ac.yu
%
% Copyright (c) 1999 by Lutovac & Tosic
% $Revision: 1.0 $ $Date: 1999/08/21 02:17:42 $
%
% References:
% Miroslav D. Lutovac, Dejan V. Tosic, Brian L. Evans
% Advanced Filter Design for Signal Processing
% Using MATLAB and Mathematica
%
a=(f+c)/2-0.4*s;
b=d;
g=c;
h=(f+d)/2-0.4*s;
if p == 0
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc);
x1 = a + s*[-0.05, 0.05, -0.05]; y1 = b + s*[ 0.05, 0, -0.05];
line(x1,y1,'Color',dc)
text(a+s*0.4,b+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','bottom')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 1
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[-0.05,0.05,-0.05];
line(x1,y1,'Color',dc)
text(g-s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 2
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[0.85, 0.75, 0.85]; y1 = b + s*[0.05, 0, -0.05];
line(x1,y1,'Color',dc)
text(a+s*0.4,b-s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','top')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 3
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[0.85,0.75,0.85];
line(x1,y1,'Color',dc)
text(g+s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','left','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 4
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[0.85, 0.75, 0.85]; y1 = b + s*[0.05, 0, -0.05];
line(x1,y1,'Color',dc)
text(a+s*0.4,b+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','bottom')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 5
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[0.85,0.75,0.85];
line(x1,y1,'Color',dc)
text(g-s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 6
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[-0.05, 0.05, -0.05]; y1 = b + s*[ 0.05, 0, -0.05];
line(x1,y1,'Color',dc)
text(a+s*0.4,b-s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','top')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 7
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[-0.05,0.05,-0.05];
line(x1,y1,'Color',dc)
text(g+s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','left','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 8
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[-0.05, 0.05, -0.05]; y1 = b + s*[ 0.05, 0, -0.05];
line(x1,y1,'Color',dc)
x2 = a + s*[0.75,0.85,0.75]; y2 = b + s*[0.05,0,-0.05];
line(x2,y2,'Color',dc)
text(a+s*0.4,b+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','bottom')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 9
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[-0.05,0.05,-0.05];
line(x1,y1,'Color',dc)
x2 = g + s*[0.05,0,-0.05]; y2 = h + s*[0.75,0.85,0.75];
line(x2,y2,'Color',dc)
text(g-s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 10
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[0.85, 0.75, 0.85]; y1 = b + s*[0.05, 0, -0.05];
line(x1,y1,'Color',dc)
x2 = a + s*[0.05,-0.05,0.05]; y2 = b + s*[0.05,0,-0.05];
line(x2,y2,'Color',dc)
text(a+s*0.4,b-s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','top')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 11
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[0.85,0.75,0.85];
line(x1,y1,'Color',dc)
x2 = g + s*[0.05,0,-0.05]; y2 = h + s*[0.05,-0.05,0.05];
line(x2,y2,'Color',dc)
text(g+s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','left','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 12
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[0.85, 0.75, 0.85]; y1 = b + s*[0.05, 0, -0.05];
line(x1,y1,'Color',dc)
x2 = a + s*[0.05,-0.05,0.05]; y2 = b + s*[0.05,0,-0.05];
line(x2,y2,'Color',dc)
text(a+s*0.4,b+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','bottom')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
elseif p == 13
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[0.85,0.75,0.85];
line(x1,y1,'Color',dc)
x2 = g + s*[0.05,0,-0.05]; y2 = h + s*[0.05,-0.05,0.05];
line(x2,y2,'Color',dc)
text(g-s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
% ,Line[({g,h}+s*#)& /@ {{0.05,0.05},{0,-0.05},{-0.05,0.05}}]
elseif p == 14
x = a + s*[(c-a)/s, 0.1, 0.1, 0.7, 0.7, 0.1, 0.1, 0.7, 0.7, (f-a)/s];
y = b + s*[ 0, 0, 0.3, 0.3,-0.3,-0.3, 0.3, 0.3, 0,0];
line(x,y,'Color',dc)
x1 = a + s*[-0.05, 0.05, -0.05]; y1 = b + s*[ 0.05, 0, -0.05];
line(x1,y1,'Color',dc)
x2 = a + s*[0.75,0.85,0.75]; y2 = b + s*[0.05,0,-0.05];
line(x2,y2,'Color',dc)
text(a+s*0.4,b-s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','center','VerticalAlignment','top')
text(a+s*0.4,b,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(a+s*0.4,b,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
else
x = g + s*[0,0,0.3,0.3,-0.3,-0.3,0.3,0.3,0,0];
y = h + s*[(d-h)/s,0.1,0.1,0.7,0.7,0.1,0.1,0.7,0.7,(f-h)/s];
line(x,y,'Color',dc)
x1 = g + s*[0.05,0,-0.05]; y1 = h + s*[-0.05,0.05,-0.05];
line(x1,y1,'Color',dc)
x2 = g + s*[0.05,0,-0.05]; y2 = h + s*[0.75,0.85,0.75];
line(x2,y2,'Color',dc)
text(g+s*0.4,h+s*0.4,t,'FontName','Times','FontSize',F,...
'HorizontalAlignment','left','VerticalAlignment','middle')
text(g,h+s*0.4,'z','FontName','Times-Italic','FontSize',F,...
'HorizontalAlignment','right','VerticalAlignment','middle')
text(g,h+s*0.4,n,'FontName','Times','FontSize',F-1,...
'HorizontalAlignment','left','VerticalAlignment','bottom')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -