-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbungee_paramKSolve.m
More file actions
executable file
·48 lines (30 loc) · 1.28 KB
/
Copy pathbungee_paramKSolve.m
File metadata and controls
executable file
·48 lines (30 loc) · 1.28 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
function [solutions] = bungee_paramKSolve(valuesMap)
% disp('DEBUG: paramKSolve');
% each row represents a list of dependancies that is sufficient to solve for the value
deplist = ...
{{'initialLength', 'equilibriumLength', 'area', 'cordMass', 'jumperMass', 'paramN', 'modulus'}; ...
};
solutions = [];
% if no nan's in the first dependancy list
nancheck = cellfun(@(x) any(isnan(valuesMap(x))), deplist{1}, 'un', 0);
if max(cell2mat(nancheck)) == 0
% disp('DEBUG: paramKSolve Solution1');
% L_e=L_0 ( mg/EA+K(mg/EA)^n+1)
initialLength = valuesMap('initialLength');
equilibriumLength = valuesMap('equilibriumLength');
jumperMass = valuesMap('jumperMass');
cordMass = valuesMap('cordMass');
weight = 9.81 * ( jumperMass + cordMass );
maxDistance = valuesMap('maxLength');
maxDistanceCM = (maxDistance * (jumperMass + 0.5*cordMass)) / (jumperMass + cordMass);
area = valuesMap('area');
paramN = valuesMap('paramN');
mod = valuesMap('modulus');
syms paramK;
solution_1 = solve( (weight / (area * mod)) + ...
paramK*(weight / (area * mod)).^paramN ...
+ 1 == (equilibriumLength / initialLength), paramK, 'PrincipalValue', true, 'Real', true);
solution_1 = double(solution_1);
solutions = [solutions solution_1];
end
end