-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexica_sim.m
More file actions
50 lines (34 loc) · 1.63 KB
/
Copy pathlexica_sim.m
File metadata and controls
50 lines (34 loc) · 1.63 KB
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
% JAS: this script simulates consonant cluster data based upon the Simplex
% Onset Hypothesis and identifies the SD of the anchor that best
% fits the data.
% Trivial modifications by SEC.
close all; clear all;
randn('state',0); %reset the random number generator
simN = 100; %number of times simulation is repeated
lexica = 9; %number of lexica
LE_RSD = zeros(simN,AN);
RE_RSD = zeros(simN,AN);
CC_RSD = zeros(simN,AN);
LE_SD = zeros(simN,AN);
RE_SD = zeros(simN,AN);
CC_SD = zeros(simN,AN);
VI = 1; %stepwise increase in variability
stdv1 = 10;
p = 20; %plateau duration
ipi = 10; %inter-plateau interval
anchor = 234.8
anchorstd = 30;
for count=1:simN %loops through iterations of the simulation
%Note about consonantal landmarks: they are replaced with each cycle of the simulation
%in constrast, {RSD,SD} values for each landmark are stored across simulations.
for cycle = 1:AN; %cycles through for each anchor point
LE_RSD(count, cycle) = std(A(cycle,:)-CL1)/(mean(A(cycle,:))-mean(CL1));
RE_RSD(count, cycle) = std(A(cycle,:)-CR3)/(mean(A(cycle,:))-mean(CR3));
CC_RSD(count, cycle) = std(A(cycle,:)-CCglobal)/(mean(A(cycle,:))-mean(CCglobal));
LE_SD(count, cycle) = std(A(cycle,:)-CL1);
RE_SD(count, cycle) = std(A(cycle,:)-CR3);
CC_SD(count, cycle) = std(A(cycle,:)-CCglobal);
end;
end %main simulation loop
x = 1:1:AN; %establishes x-axis as anchor
plot(x, mean(RE_RSD(:,x)), 'r-',x, mean(CC_RSD(:,x)), 'k--');