Open DRuizB opened 5 years ago
Another issue, our program does not interpret well symbolically piecewise functions. It basically crashes.
Try the same code above changing the non-linearity by:
aa=5; cc=0.20; syms G(x); G(x) = piecewise(x<=-aa, -2aa^2xcc-2aaaaaacc, aa<=x, -2aaaaxcc+2aaaaaacc, -aa<x<aa, -ccx(x-aa)(x+aa));
Matlab console output: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Error using symengine Unable to generate code for piecewise for use in anonymous functions.
Error in sym/matlabFunction>mup2mat (line 404) res = mupadmex('symobj::generateMATLAB',r.s,ano,spa,0);
Error in sym/matlabFunction>mup2matcell (line 374) r = mup2mat(c{1},true,sparseMat);
Error in sym/matlabFunction (line 188) body = mup2matcell(funs, opts.Sparse);
Error in ode (line 94) obj.numF = matlabFunction(obj.symF);
Error in SLSD1doptimalnullcontrol (line 68) odeEqn2 = ode(Fsym,symY,symU,'Y0',Y0,'T',T);
Error in plots (line 30) [a,b,c,d]=SLSD1doptimalnullcontrol(N,1,G,T,beta,[0.25,0.75],y0); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-I started a simulation with my code for a semilinear heat equation. -I set a non-linearity that might have a blow-up for certain initial conditions. -For such non-linarity there are theoretical results that say: even if there might be a blow up for a certain initial data, we can build a control that avoids the blow up. -I set an initial data for which there is no blow-up before the integration time T=1 (it may exist afterwards). -One can see that the free dynamics grows but it does not blow up. -HOWEVER, THE CONTROLLED DYNAMICS BLOWS-UP when the target of the optimal control was 0.
Here there is the code that I used and the graphics plotted. (note that the controlled dynamics is not integrated over all [0,1])
The function to be executed is plots.m but it requires the other one as well as the whole DyCon toolbox
SLSD1doptimalnullcontrol.txt
plots.txt