Plotting PAHS and Simulations

In order to visualise the results of the control synthesis via discrete game abstraction a plotting function has been included for systems with 2 dimensional dynamics. The plotting function plots each modes partition and overlays one or more of the requirements, discrete game specification or the results of a simulation.

Plotting PAHS
%Compute a controller and simulate
pahs=demopahs2();
dgabs=finddiscgame(pahs);
req=demoreq2();
spec=req2spec(pahs,req);
[win,sol]=finddgsol(dgabs,spec);
if(win)
   disp('Winning')
   ctcat=sol2ctrl(pahs,dgabs,sol);

   l0=req.init{1}.loc;
   m0=req.init{1}.modes(1);
   x0=mean(horzcat(pahs.mode{m0}.loc{l0}.s.vertices{:}),2);

   events{1}.time=3;
   events{1}.mode=2;

   simtime=1000;
   step=.5;

   [x,t,m,l]=simpahs(pahs,ctcat,x0,l0,m0,simtime,events,step);


   %Plot the pahs with requirements
   plotpahs(pahs,req);

   %Plot the pahs with specifications
   plotpahs(pahs,{},spec);

   %plot the pahs with a simulation and requirements overlayed
   plotpahs(pahs,req,x,t,events,m0);

    %plot the pahs with a simulation and specification overlayed
   plotpahs(pahs,{},spec,x,t,events,m0);

end