-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcscatter.m
More file actions
39 lines (32 loc) · 832 Bytes
/
cscatter.m
File metadata and controls
39 lines (32 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function varargout = cscatter(r,cl,lw,ls)
% Function that scatter plots on the complex plane.
% Useful for work in DSP and SLR beta-polynomials
% e.g. to plot for a filter: cscatter(roots(b))
% 23/7/2015 Samy Abo Seada
% 13/01/2016 - allow color input
% 03/03/2016 - allow linewidth and line-spec of the unit circle
nout = nargout;
if nargin == 1
cl = 'b'; %By default use blue as color.
lw = 2;
ls = '-.r';
end
if nargin == 2
lw = 2;
ls = '-.r';
end
if nargin == 3
ls = '-.r';
end
% scatter(real(r),imag(r),'color',cl,'linewidth',lw);
sh = scatter(real(r),imag(r),'MarkerEdgeColor',cl,'linewidth',lw);
hold on;
grid on;
unit_circle=exp(1i*(0:0.001:2*pi));
plot(real(unit_circle),imag(unit_circle),ls)
% If output requested, return scatter handle
if nout == 1
varargout{1} = sh;
end
hold off;
end