48 this =
this@models.pcdi.BaseCoreFun(dynsys);
53 copy = models.pcdi.InhibitCoreFun2D(this.
System);
56 copy =
clone@models.pcdi.BaseCoreFun(
this, copy);
69 this.
hlp.d1= s.Dims(1);
70 this.
hlp.d2= s.Dims(2);
72 this.
idxmat= zeros(s.Dims(1),s.Dims(2));
79 this.
hlp.xr= a(1,2)-a(1,1);
81 this.
hlp.yr= a(2,2)-a(2,1);
83 this.
hlp.xd= abs(((1:this.
hlp.d1)-1)*
this.System.h-.5*
this.hlp.xr)^
t;
85 this.
hlp.yd= abs(((1:this.
hlp.d2)-1)*
this.System.h-.5*
this.hlp.yr)^
t;
94 i = repmat(this.
nodepos(1),1,5);
98 i = [i repmat(this.
nodepos(2),1,5)];
99 j = [j this.
nodepos([1:2 4 5 7])];
102 i = [i repmat(this.
nodepos(3),1,2)];
106 i = [i repmat(this.
nodepos(4),1,2)];
112 i = [i repmat(this.
nodepos(5),1,3)];
116 i = [i repmat(this.
nodepos(6),1,3)];
120 i = [i repmat(this.
nodepos(7),1,3)];
124 i = [i repmat(this.
nodepos(8),1,3)];
148 diff = this.
System.CurCXMU;
152 rc = this.
System.ReacCoeff;
169 pos = this.
hlp.xd <= this.
hlp.xr*
mu(1)/2;
171 rb(idx) = (xi(idx)*
mu(2)*ud);
173 pos = this.
hlp.xd <= this.
hlp.xr*
mu(1)/2;
174 idx = this.
idxmat(pos,end);
175 rb(idx) = rb(idx) + (xi(idx)*
mu(2)*ud);
179 pos = this.
hlp.yd <= this.
hlp.yr*
mu(1)/2;
180 idx = this.
idxmat(end,pos);
181 rb(idx) = rb(idx) + (xi(idx)*
mu(2)*ud);
183 pos = this.
hlp.yd <= this.
hlp.yr*
mu(1)/2;
185 rb(idx) = rb(idx) + (xi(idx)*
mu(2)*ud);
191 fx(1:m) = rc(2)*xi.*ya - rc(5)*xa -rc(11)*xa.*bar + rc(18)*xb + rb/this.
hlp.hs;
193 fx(m+1:2*m) = rc(1)*yi.*xan - rc(6)*ya - rc(3)*ya.*iap + rc(14)*yb;
195 fx(2*m+1:3*m) = -rc(2)*xi.*ya - rc(9)*xi + rc(16)*diff - rb/this.
hlp.hs;
197 fx(3*m+1:4*m) = -rc(1)*yi.*xan - rc(10)*yi + rc(17)*diff;
199 fx(4*m+1:5*m) = -(rc(3)+rc(4))*ya.*iap - rc(8)*iap + rc(15)*diff + rc(14)*yb;
201 fx(5*m+1:6*m) = -rc(11)*xa.*bar + rc(18)*xb - rc(19)*bar + rc(19)*diff;
203 fx(6*m+1:7*m) = rc(3)*ya.*iap -(rc(14)+rc(7))*yb;
205 fx(7*m+1:8*m) = rc(11)*xa.*bar-(rc(18)+rc(13))*xb;
223 error(
" not usable due to spatially dependent production rates. ");
232 rc = this.
System.ReacCoeff;
236 xan = bsxfun(@power,xa,
mu(4,:));
240 iap = x(4*m+1:5*m,:);
241 bar = x(5*m+1:6*m,:);
250 xd = repmat(this.
hlp.xd,1,nd);
253 pos = bsxfun(@lt,xd,this.
hlp.xr*mu(1,:)/2);
255 rb(idx,:) = pos .* (bsxfun(@times,xi(idx,:),
mu(2,:).*ud));
257 pos = bsxfun(@lt,xd,this.
hlp.xr*mu(1,:)/2);
259 rb(idx,:) = rb(idx,:) + pos .* (bsxfun(@times,xi(idx,:),
mu(2,:).*ud));
262 yd = repmat(this.
hlp.yd,1,nd);
264 pos = bsxfun(@lt,yd,this.
hlp.yr*mu(1,:)/2);
266 rb(idx,:) = rb(idx,:) + pos .* (bsxfun(@times,xi(idx,:),
mu(2,:).*ud));
268 pos = bsxfun(@lt,yd,this.
hlp.yr*mu(1,:)/2);
270 rb(idx,:) = rb(idx,:) + pos .* (bsxfun(@times,xi(idx,:),
mu(2,:).*ud));
273 fx(1:m,:) = rc(2)*xi.*ya - rc(5)*xa -rc(11)*xa.*bar + rc(18)*xb + rb/this.
hlp.hs;
275 fx(m+1:2*m,:) = rc(1)*yi.*xan - rc(6)*ya - rc(3)*ya.*iap + rc(14)*yb;
277 fx(2*m+1:3*m,:) = -rc(2)*xi.*ya - rc(9)*xi + rc(16) - rb/this.
hlp.hs;
279 fx(3*m+1:4*m,:) = -rc(1)*yi.*xan - rc(10)*yi + rc(17);
281 fx(4*m+1:5*m,:) = -(rc(3)+rc(4))*ya.*iap - rc(8)*iap + rc(15) + rc(14)*yb;
283 fx(5*m+1:6*m,:) = -rc(11)*xa.*bar + rc(18)*xb - rc(19)*bar + rc(19);
285 fx(6*m+1:7*m,:) = rc(3)*ya.*iap -(rc(14)+rc(7))*yb;
287 fx(7*m+1:8*m,:) = rc(11)*xa.*bar-(rc(18)+rc(13))*xb;
300 rc = this.
System.ReacCoeff;
303 bottom = this.
idxmat(this.
hlp.xd <=
this.hlp.xr*
mu(1)/2,1);
304 top = this.
idxmat(this.
hlp.xd <=
this.hlp.xr*
mu(1)/2,end);
305 right = this.
idxmat(end,this.
hlp.yd <=
this.hlp.yr*
mu(1)/2);
306 left = this.
idxmat(1,this.
hlp.yd <=
this.hlp.yr*
mu(1)/2);
309 rbxi(bottom) =
mu(2)*u;
311 rbxi(right) =
mu(2)*u;
312 rbxi(left) =
mu(2)*u;
313 rbxi = rbxi/this.
hlp.hs;
318 xa = x(
hlp(1,:)); ya = x(
hlp(2,:));
319 xi = x(
hlp(3,:)); yi = x(
hlp(4,:));
320 iap = x(
hlp(5,:)); bar = x(
hlp(6,:));
324 s = [-o*rc(5)-rc(11)*bar; ...
335 nyixan_1 =
mu(4)*rc(1)*yi.*xa.^(
mu(4)-1);
336 k1xan = rc(1)*xa.^
mu(4);
337 s = [s; nyixan_1; ...
339 -o*rc(6) - rc(3)*iap;...
349 s = [s; -rc(2)*xi;...
351 -rc(2)*xa-rc(9)-rbxi];
354 s = [s; -nyixan_1; ...
362 s = [s; -(rc(3)+rc(4))*iap; ...
364 -(rc(3)+rc(4))*ya-rc(8);
369 s = [s; -rc(11)*bar; ...
377 s = [s; rc(3)*iap; ...
384 s = [s; rc(11)*bar; ...
399 J = sparse(this.
Ji,this.
Jj,s,n,m);
413 fxj = zeros(length(pts),nd);
414 rc = this.
System.ReacCoeff;
415 diff = this.
System.CurCXMU;
417 bottom = bsxfun(@lt,this.
hlp.xd,
this.hlp.xr*mu(1,:)/2);
418 top = bsxfun(@lt,this.
hlp.xd,
this.hlp.xr*mu(1,:)/2);
419 right = bsxfun(@lt,this.
hlp.yd,
this.hlp.yr*mu(1,:)/2);
420 left = bsxfun(@lt,this.
hlp.yd,
this.hlp.yr*mu(1,:)/2);
422 bottom = this.
hlp.xd <= this.
hlp.xr*
mu(1,:)/2;
423 top = this.
hlp.xd <= this.
hlp.xr*
mu(1,:)/2;
424 right = this.
hlp.yd <= this.
hlp.yr*
mu(1,:)/2;
425 left = this.
hlp.yd <= this.
hlp.yr*
mu(1,:)/2;
433 row = rem(J2-1, this.
hlp.d1)+1;
434 col = (J2-row)/this.
hlp.d1+1;
435 u =
this.activationFun(t, mu);
436 for idx=1:length(pts)
444 xidx = (st+1):ends(idx);
452 fj = rc(2)*x(3,:).*x(2,:) - rc(5)*x(1,:) -rc(11)*x(1,:).*x(4,:) + rc(18)*x(5,:);
457 fj = fj + bottom(row(idx),:) .* (x(3,:).*
mu(2,:).*u/this.
hlp.hs);
460 if col(idx) == this.
hlp.d2
461 fj = fj + top(row(idx),:) .* (x(3,:).*
mu(2,:).*u/this.
hlp.hs);
464 if row(idx) == this.
hlp.d1
465 fj = fj + right(col(idx),:) .* (x(3,:).*
mu(2,:).*u/this.
hlp.hs);
469 fj = fj + left(col(idx),:) .* (x(3,:).*
mu(2,:).*u/this.
hlp.hs);
476 elseif m < j && j <= 2*m
477 fj = rc(1)*x(3,:).*x(1,:).^
mu(4,:) - rc(6)*x(2,:) - rc(3)*x(2,:).*x(4,:) + rc(14)*x(5,:);
483 elseif 2*m < j && j <= 3*m
484 fj = -rc(2)*x(2,:).*x(1,:) - rc(9)*x(2,:) + rc(16);
489 fj = fj - bottom(row(idx),:) .* (x(2,:).*
mu(2,:).*u/this.
hlp.hs);
492 if col(idx) == this.
hlp.d2
493 fj = fj - top(row(idx),:) .* (x(2,:).*
mu(2,:).*u/this.
hlp.hs);
496 if row(idx) == this.
hlp.d1
497 fj = fj - right(col(idx),:) .* (x(2,:).*
mu(2,:).*u/this.
hlp.hs);
501 fj = fj - left(col(idx),:) .* (x(2,:).*
mu(2,:).*u/this.
hlp.hs);
508 elseif 3*m < j && j <= 4*m
509 fj = -rc(1)*x(2,:).*x(1,:).^
mu(4,:) - rc(10)*x(2,:) + rc(17);
515 elseif 4*m < j && j <= 5*m
516 fj = -(rc(3)+rc(4))*x(1,:).*x(2,:) - rc(8)*x(2,:) + rc(15) + rc(14)*x(3,:);
522 elseif 5*m < j && j <= 6*m
523 fj = -rc(11)*x(1,:).*x(2,:) + rc(18)*x(3,:) - rc(19)*x(2,:) + rc(19);
529 elseif 6*m < j && j <= 7*m
530 fj = rc(3)*x(1,:).*x(2,:) -(rc(14)+rc(7))*x(3,:);
537 fj = rc(11)*x(1,:).*x(2,:)-(rc(18)+rc(13))*x(3,:);
564 error(
" Activation fun not yet implemented correctly ");
566 rc = this.
System.ReacCoeff;
573 row = rem(pts2-1, this.
hlp.d1)+1;
574 col = (pts2-row)/this.
hlp.d1+1;
576 bottom = bsxfun(@lt,this.
hlp.xd,
this.hlp.xr*mu(1)/2);
577 top = bsxfun(@lt,this.
hlp.xd,
this.hlp.xr*mu(1)/2);
578 right = bsxfun(@lt,this.
hlp.yd,
this.hlp.yr*mu(1)/2);
579 left = bsxfun(@lt,this.
hlp.yd,
this.hlp.yr*mu(1)/2);
581 bottom = this.
hlp.xd <= this.
hlp.xr*
mu(1)/2;
582 top = this.
hlp.xd <= this.
hlp.xr*
mu(1)/2;
583 right = this.
hlp.yd <= this.
hlp.yr*
mu(1)/2;
584 left = this.
hlp.yd <= this.
hlp.yr*
mu(1)/2;
588 der =
false(size(X,1),1);
592 dfx = zeros(size(deriv,1),nd);
594 for idx=1:length(pts)
602 elem = (st+1):ends(idx);
611 dfx(curpos,:) = -rc(3);
616 dfx(curpos,:) = rc(1)*x(3,:);
621 dfx(curpos,:) = rc(1)*x(2,:);
624 dfx(curpos,:) = dfx(curpos,:) + bottom(row(idx),:) .*
mu(2,:)/this.
hlp.hs;
626 if col(idx) == this.
hlp.d2
628 dfx(curpos,:) = dfx(curpos,:) + top(row(idx),:) .*
mu(2,:)/this.
hlp.hs;
630 if row(idx) == this.
hlp.d1
632 dfx(curpos,:) = dfx(curpos,:) + right(col(idx),:) .*
mu(2,:)/this.
hlp.hs;
636 dfx(curpos,:) = dfx(curpos,:) + left(col(idx),:) .*
mu(2,:)/this.
hlp.hs;
642 elseif m < i && i <= 2*m
646 dfx(curpos,:) =
mu(4,:)*rc(2)*x(3,:).*x(1,:).^(
mu(4,:)-1);
651 dfx(curpos,:) = -rc(4);
656 dfx(curpos,:) = rc(2)*x(1,:).^
mu(4,:);
661 elseif 2*m < i && i <= 3*m
665 dfx(curpos,:) = -rc(1)*x(2,:);
670 dfx(curpos,:) = -rc(1)*x(1,:)-rc(5);
674 dfx(curpos,:) = dfx(curpos,:) - bottom(row(idx),:) .*
mu(2,:)/this.
hlp.hs;
676 if col(idx) == this.
hlp.d2
678 dfx(curpos,:) = dfx(curpos,:) - top(row(idx),:) .*
mu(2,:)/this.
hlp.hs;
680 if row(idx) == this.
hlp.d1
682 dfx(curpos,:) = dfx(curpos,:) - right(col(idx),:) .*
mu(2,:)/this.
hlp.hs;
686 dfx(curpos,:) = dfx(curpos,:) - left(col(idx),:) .*
mu(2,:)/this.
hlp.hs;
696 dfx(curpos,:) = -
mu(4,:)*rc(2)*x(2,:).*x(1,:).^(
mu(4,:)-1);
701 dfx(curpos,:) = -rc(2)*x(1,:).^
mu(4,:) - rc(6);
integer fDim
The current output dimension of the function.
function copy = clone()
System already copied in constructor (see below)
function idx = nodepos(nr)
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
integer xDim
The current state space dimension of the function's argument .
function dfx = evaluateComponentPartialDerivatives(rowvec< integer > pts,rowvec< integer > ends, unused1,rowvec< integer > deriv, unused2,colvec< double > X, unused3,colvec< double > mu, unused4)
See dscomponents.ACompEvalCoreFun for more details.
function J = getStateJacobian(colvec< double > x,double t)
models.BaseFirstOrderSystem System
The system associated with the current ACoreFun.
function fx = evaluate(colvec< double > x,double t)
If this has been projected, restore full size and compute values.
function f = activationFun(double t,colvec< double > mu)
V
The matrix of the biorthogonal pair .
colvec< double > mu
The current model parameter mu for evaluations. Will not be persisted as only valid for runtime durin...
The core nonlinear function of the PCD model.
sparse< logical > JSparsityPattern
Sparsity pattern for the jacobian matrix.
function fxj = evaluateComponents(pts, ends, globidx, unused1, X,double t)
W
The matrix of the biorthogonal pair .
function fx = evaluateMulti(colvec< double > x,double t,colvec< double > mu)
function fxj = evaluateComponentsMulti(rowvec< integer > pts,rowvec< integer > ends, globidx, unused1,matrix< double > X,double t,matrix< double > mu)
The vector embedding results from the fixed ordering of the full 4*m-vector into the components x_a...
function newSysDimension()
Create diffusion matrix.