-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpenetrable_disk.m
71 lines (50 loc) · 1.79 KB
/
penetrable_disk.m
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% Class representing penetrable scatterers
%
% scat = penetrable_disk(k,r,nu) sets up object for a circle with radius r.
% The wavenumber is k and the refractive index is nu.
%
% scat.plot() plots the scatterer.
%
% h = scat.plot() plots the scatterer and returns the handle h of the
% graphics object.
%
% See also: design, sound_soft_disk, sound_hard_disk, tmatsolver.
%
% Stuart C. Hawkins - 12 January 2023
classdef penetrable_disk < design
properties
radius
end
methods
%-----------------------------------------------
% constructor
%-----------------------------------------------
function self = penetrable_disk(kwave,radius,name,nu)
% set default name
if nargin<3 || isempty(name)
name = 'penetrable disk';
end
% get order for T-matrix using Wiscombe's formula
n = suggestedorder(kwave,radius);
% compute the T-matrix
T = mie_tmatrix(kwave,radius,n,'PENETRABLE',[],nu);
% call the parent constructor to setup the scatterer
self = self@design(T,name);
% radius is stored only in case we want to plot the scatterer
self.radius = radius;
end
%-----------------------------------------------
% plot function
%-----------------------------------------------
function varargout = plot(self)
% get angles in [0,2*pi] to plot the circle
theta = linspace(0,2*pi,200);
% plot the circle
h = plot(self.radius*cos(theta),self.radius*sin(theta),'k-');
% return graphics handle if needed
if nargout>0
varargout{1} = h;
end
end
end
end