Rev | Line | |
---|
[37] | 1 | function x = evaluate_nonlinear(p,x) |
---|
| 2 | |
---|
| 3 | if ~isempty(p.bilinears) |
---|
| 4 | x(p.bilinears(:,1)) = x(p.bilinears(:,2)).*x(p.bilinears(:,3)); |
---|
| 5 | |
---|
| 6 | badones = find(sum(p.monomtable(p.bilinears(:,1),:),2)>2); |
---|
| 7 | if ~isempty(badones) |
---|
| 8 | redo = p.bilinears(badones,1); |
---|
| 9 | for i = 1:length(redo) |
---|
| 10 | these = find(p.monomtable(redo(i),:)); |
---|
| 11 | x(redo(i)) = prod(x(these).^((p.monomtable(redo(i),these))')); |
---|
| 12 | end |
---|
| 13 | end |
---|
| 14 | else |
---|
| 15 | x = x(1:length(p.c)); |
---|
| 16 | nonlinear = find(p.variabletype); |
---|
| 17 | x(nonlinear) = prod(repmat(x(:)',length(nonlinear),1).^p.monomtable(nonlinear,:),2); |
---|
| 18 | end |
---|
| 19 | |
---|
| 20 | for i = 1:length(p.evalMap) |
---|
| 21 | arguments = {p.evalMap{i}.fcn,x(p.evalMap{i}.variableIndex)}; |
---|
| 22 | arguments = {arguments{:},p.evalMap{i}.arg{2:end-1}}; |
---|
| 23 | x(p.evalVariables(i)) = feval(arguments{:}); |
---|
| 24 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.