Example of DesignEllipticFilter.xml produced a warning, 66/18866/2
Adeline CARNIS [Wed, 11 Jan 2017 11:45:58 +0000 (12:45 +0100)]
addition/substraction with an empty matrix(call csim).

Change-Id: I787c020517f3b722e1e7ecb295c6c6930ebee4a6

scilab/modules/cacsd/macros/csim.sci

index ed0f34b..c57dc7a 100644 (file)
@@ -135,12 +135,14 @@ function [y,x]=csim(u,dt,sl,x0,tol)
         ut=u;
         if min(size(ut))==1 then ut=matrix(ut,1,-1),end
         deff("[y]=u(t)",["ind=find(dt<=t);nn=ind($)"
-        "if (t==dt(nn)|nn==nt) then "
+        "if isempty(nn) then"
+        "y=[]"
+        "elseif (t==dt(nn)|nn==nt) then "
         "   y=ut(:,nn)"
         "else "
         "   y=ut(:,nn)+(t-dt(nn))/(dt(nn+1)-dt(nn))*(ut(:,nn+1)-ut(:,nn))"
         "end"]);
-        deff("[ydot]=%sim2(%tt,%y)","ydot=ak*%y+bk*u(%tt)");
+        deff("[ydot]=%sim2(%tt,%y)","ydot = [];if ~isempty(u(%tt)) then ydot = ak*%y+bk*u(%tt);end");
     elseif type(u)<>15 then
         deff("[ydot]=%sim2(%tt,%y)","ydot=ak*%y+bk*u(%tt)");
         ut=ones(mb,nt);for k=1:nt, ut(:,k)=u(dt(k)),end