Fix some demos errors/warnings 60/18860/1
Paul Bignier [Mon, 9 Jan 2017 14:53:19 +0000 (15:53 +0100)]
Change-Id: If8debc9aec3777f495878ec568f9de3f6d27718d

scilab/modules/core/demos/intro/online_definition_fct.dem.sce
scilab/modules/core/demos/intro/optimization_simulation.dem.sce
scilab/modules/graphics/macros/fchamp.sci

index 83b6351..58a8b1d 100644 (file)
@@ -8,5 +8,5 @@ mode(7)
 //To quit this demo, enter CTRL+C, then type "abort"
 
 //              INLINE DEFINITION OF FUNCTION
-deff("[x]=fact(n)","if n==0 then x=1,else x=n*fact(n-1),end")
+deff("x = fact(n)", "if n==0 then x = 1; else x = n*fact(n-1); end")
 10+fact(5)
index edc9d6d..9c45795 100644 (file)
@@ -8,12 +8,12 @@ mode(7)
 //To quit this demo, enter CTRL+C, then type "abort"
 
 //                    OPTIMIZATION
-deff("[f,g,ind]=rosenbro(x,ind)", "a=x(2)-x(1)^2 , b=1-x(2) ,...
-f=100.*a^2 + b^2 , g(1)=-400.*x(1)*a , g(2)=200.*a -2.*b ");
-[f,x,g]=optim(rosenbro,[2;2],"qn")
+deff("[f, g, ind] = rosenbro(x, ind)", "a = x(2)-x(1)^2; b = 1-x(2);" + ..
+"f = 100.*a^2 + b^2; g(1) = -400.*x(1)*a; g(2) = 200.*a -2.*b;");
+[f, x, g] = optim(rosenbro, [2; 2], "qn")
 
 //                   SIMULATION
-a=rand(3,3)
-e=expm(a)
-deff("[ydot]=f(t,y)","ydot=a*y");
-e(:,1)-ode([1;0;0],0,1,f)
+a = rand(3, 3)
+e = expm(a)
+deff("ydot = f(t, y)", "ydot = a*y");
+e(:,1) - ode([1;0;0],0,1,f)
index ad0db33..22033c8 100644 (file)
@@ -37,8 +37,8 @@ function [] = fchamp(macr_f,fch_t,fch_xr,fch_yr,arfact,rect,strf)
         end
         // Preparing the ODE
         deff(" xdot = derpol(t,x)",..
-                      "xdot = [ x(2) ; -x(1) + (1 - x(1)**2)*x(2) ]")
-       // Plotting is (x, dx/dt) graph
+        "xdot = [ x(2) ; -x(1) + (1 - x(1)**2)*x(2) ]")
+        // Plotting is (x, dx/dt) graph
         rect = [-1.1 -1.1 1.1 1.1]
         fchamp(derpol,0,-1:0.1:1,-1:0.1:1,0.7,rect,"011")
 
@@ -70,6 +70,8 @@ function [] = fchamp(macr_f,fch_t,fch_xr,fch_yr,arfact,rect,strf)
     end
     fch_v=feval(fch_xr,fch_yr,mmm);
 
-
+    if isempty(opts) then
+        opts = "";
+    end
     execstr("champ(fch_xr,fch_yr,real(fch_v),imag(fch_v),"+strcat(opts,",")+")")
 endfunction