-
Notifications
You must be signed in to change notification settings - Fork 11
/
Material.m
37 lines (37 loc) · 1.29 KB
/
Material.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
classdef Material
% class Material
% Data structure holding material constants.
% Has Static Creator methods for each type of material.
% Has no methods that include physics.
properties
E % Elastic Modulus [Pa]
nu % Poisson coefficient
rho % Density [kg/m3]
D % Piezo Coefficients [C/m2] [3x6]
e % Electric permitivity [C/Nm2]
end
methods
function obj = Material(E,nu,rho)
require(isnumeric([E,nu,rho]), ...
'ArgumentError: E,nu, and rho should be numeric')
require(all([E,nu,rho]>=0), ...
'ArgumentError: E,nu, and rho should be greater than 0')
obj.E = E;
obj.nu = nu;
obj.rho = rho;
end
end
methods (Static)
function obj = Piezo(E,nu,rho,D,permitivity)
require(isnumeric(D), ...
'ArgumentError: D should be numeric')
require(all(size(D)==[3,6]), ...
'ArgumentError: D should be size [3x6]')
require(isnumeric(permitivity), ...
'ArgumentError: permitivity should be numeric')
obj = Material(E,nu,rho);
obj.D = D;
obj.e = permitivity;
end
end
end