Re: [Scilab-users] Linearizing a model with COSELICA blocks

2013-01-28 Thread Clément David
Hello,

It is possible to linearize a modelica model however I should compile
(in the sense of producing an Xcos block from a modelica diagram) first.

Just define "needcompile=4" before calling lincos and open a
non-documented bug.

--
Clément

Le vendredi 25 janvier 2013 à 09:26 -0800, amiege a écrit :
> Hi, I am trying to linearize a model that I built using COSELICA
> blocks in Scilab 5.4.0. All the COSELICA blocks are encapsulated in a
> superblock, which has standard xcos inputs and outputs. I followed the
> example shown in the documentation for lincos, but I am getting the
> following error: 
> -->importXcosDiagram("DC_motor.zcos")
>  ans  =
>  
>   T  
>  
> -->for i=1:length(scs_m.objs)
> -->if typeof(scs_m.objs(i))=="Block" & scs_m.objs(i).gui=="SUPER_f" then
> -->temp = scs_m.objs(i).model.rpar;
> -->disp("Superblock found")
> -->break;
> -->end
> -->end
>  
>  Superblock found   
>  
> -->sys = lincos(temp)
> \
>  Main Modelica : C:\DOCUME~1\ajpm\LOCALS~1\Temp\SCI_TMP_3704_\_im.mo
> 
>  !--error 4 
> Undefined variable: needcompile
> at line  42 of function compile_modelica called by :  
> at line  40 of function build_modelica_block called by :  
> at line 230 of function c_pass1 called by :  
> at line 118 of function lincos called by :  
> sys = lincos(temp)
> Can anybody help? Is it even possible to linearize a model with
> COSELICA blocks? Thanks, Arnaud 
> 
> __
> View this message in context: Linearizing a model with COSELICA blocks
> Sent from the Scilab users - Mailing Lists Archives mailing list
> archive at Nabble.com.
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Problem with ATOMS

2013-01-28 Thread Stéphane Mottelet

Hello,

this problem is fixed in the current developpement version of the 
plotlib, a new version will be released this week.


S.

Le 28/01/13 08:52, Vincent COUVERT a écrit :

Hello,

It seems that this error is due to plotlib since the error message 
indicates that the error occurred at line 46 of uicontrol and this 
line does not exists in Sciab uicontrol function (which is a C function).


Can you report this issue to the author 
(http://atoms.scilab.org/toolboxes/plotlib)?


Regards.


Le 27/01/13 22:54, René Grognard a écrit :

In my professional work I had access and used MATLAB for many years.
Now retired I have to switch to some free/less expensive equivalent
software and I just downloaded Scilab that seems to offer more
toolboxes.

However ATOMS does not seem to work.

My PC is a HP ProBook 4730s running Windows 7. (Cygwin 1.7 is
installed and coud be used to run WScilex.exe.)

When I started Scilab-5.4.0 all appeared to be well:

Startup execution:
   loading initial environment
  -->atomsSetConfig('Verbose','True')
  ans  =
 1.
-->atomsGetConfig()
  ans  =
downloadTool: "curl"
Verbose: "True"

The  window Main categories - ATOMS was functional and allowed me to
install say the Plotting library particularly promising to a MATLAB
ex-user --- I get the message:

Installation done! Please restart Scilab to take changes into account.

OK restarting:

Startup execution:
   loading initial environment

Start plotlib toolbox 0.43
Load macros
Load help

   !--error 999
'background' property does not exist for this handle.
at line  46 of function uicontrol called by :
at line 207 of function atomsGui called by :
ms") then atomsGui(); else disp(gettext("
while executing a callback

The error message itself seems garbled!

The next one seems clearer:

-->atomsGui()
  !--error 999
'background' property does not exist for this handle.
at line  46 of function uicontrol called by :
at line 207 of function atomsGui called by :
atomsGui()

The window Main categories - ATOMS  which appears is now empty and
indeed as "dead" as a dodo.

I checked that I have full control over the SCIHOME folder and its 
contents.


I regularly update the free JAVA which I believe is used by Scilab.

What did I do wrong/missed in installing Scilab-5.4.0?

Any help/info will be appreciated.

Regards,

René.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Identification Toolbox Documentation

2013-01-28 Thread Serge Steer

The identification functions help pages can be found in the CACSD chapter
look at findABCD, findBD, findAC,...
but also imprep2ss, armax, ...

Serge Steer

Le 25/01/2013 18:18, AntonSeab a écrit :

Hi

It would be great if you could point me to some documentation for the
Identification Toolbox. Searched Scilab website and googled Scilab
Identification Toolbox but couldn't get any documentation results

Antonio




--
View this message in context: 
http://mailinglists.scilab.org/Identification-Toolbox-Documentation-tp4025760.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Linearizing a model with COSELICA blocks

2013-01-28 Thread amiege
Clément David-2 wrote
> Hello,It is possible to linearize a modelica model however I should
> compile(in the sense of producing an Xcos block from a modelica diagram)
> first.Just define "needcompile=4" before calling lincos and open
> anon-documented bug.

Thank you, that works indeed. I have opened bug #12256.Arnaud



--
View this message in context: 
http://mailinglists.scilab.org/Linearizing-a-model-with-COSELICA-blocks-tp4025761p4025795.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Ezequiel Soule

Hello, I am using some iterative algorithm defined as a function in a .sci 
file, and I have the following problem: the iterations in the algorithm are 
controlled by a given variable. Now, if I define another variable, (which DO 
NOT affect the values of the control variable nor the way it is calculated) in 
the function, the number of iterations to converge changes! What happens is 
that the value of the control variable, for some reason, is modified. It is not 
a very significant modification, actually the difference is in the order of 
10^-15... the problem is that this difference propagates exponentially as the 
iterations advance, and the total number of iterations and the final result 
(which is not unique) can be modified drastically!
My question is, why the value of the control variable is modifyied by the definition a 
completely independent variable. I saw this problem in scilab 5.4.0 and 5.2.2. I also had 
a similar, but worse, problem, before with a similar algorithm. I just added a command 
"pause" in the function, and this command was even OUTSIDE the while loop that 
defined the iterations... and the number of iterations was modyfied. How can this happen?

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Dang, Christophe
Hello, 

> Now, if I define another variable,
> the number of iterations to converge changes!
[...]
> the problem is that this difference propagates exponentially 

Maybe you could send us a "minimal" script reproducing the problem?

Regards

-- 
Christophe Dang Ngoc Chan
Mechanical calculation engineer

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Rafael Guerra
Ezequiel,

I recommend you to create a minimal code example which reproduces the
problem you have at hands and to submit it to the users list for evaluation.
It will be easier to help you.

Best regards.
Rafael G.

-Original Message-
From: users-boun...@lists.scilab.org [mailto:users-boun...@lists.scilab.org]
On Behalf Of Ezequiel Soule
Sent: Monday, January 28, 2013 10:14 AM
To: users@lists.scilab.org
Subject: [Scilab-users] modifying a variable changes the value of another
variable!!!

Hello, I am using some iterative algorithm defined as a function in a .sci
file, and I have the following problem: the iterations in the algorithm are
controlled by a given variable. Now, if I define another variable, (which DO
NOT affect the values of the control variable nor the way it is calculated)
in the function, the number of iterations to converge changes! What happens
is that the value of the control variable, for some reason, is modified. It
is not a very significant modification, actually the difference is in the
order of 10^-15... the problem is that this difference propagates
exponentially as the iterations advance, and the total number of iterations
and the final result (which is not unique) can be modified drastically!
My question is, why the value of the control variable is modifyied by the
definition a completely independent variable. I saw this problem in scilab
5.4.0 and 5.2.2. I also had a similar, but worse, problem, before with a
similar algorithm. I just added a command "pause" in the function, and this
command was even OUTSIDE the while loop that defined the iterations... and
the number of iterations was modyfied. How can this happen?

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread constantina
If I have a vector , por example M= rand(418,1) , how can I implement the
same procediment?? 



--
View this message in context: 
http://mailinglists.scilab.org/Peaks-and-positions-tp4025764p4025799.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread Dang, Christophe
Hello, 

> If I have a vector , por example M= rand(418,1)

Just a question of vocabulary,
are you lookng for peaks with a given width, such as
or for "one-pixel" wide peaks,
which are sometimes refered to as "spikes"?

For spikes, you can use the cade given by Samuel,
just removing the "pC".

If the peaks have a given width,
you can locate the minima of the second derivative,
best after smoothing, e.g.

http://commons.wikimedia.org/wiki/File:Desommation_trois_pics_gaussiens_21pts.svg

(source code here : 
http://commons.wikimedia.org/wiki/File:Detection_pic_savitzky_Golay.svg#Scilab_source
 )

Best regards

-- 
Christophe Dang Ngoc Chan
Mechanical calculation engineer




This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Ezequiel Soulé
The algorithm essentially starts with a set of spheres in random positions
and in a relatively dense state, and runs an iterative process where the
spheres are moved in each iteration in order to reduce the overlaps.
The core of the script is more or less like this


   superp=calc_D_superp_dobcel(pos);  //this line uses an external
function to calculate a matrix with the overlap between paritcles,
defined as superp(i,j)=max(R(i)+R(j)-D(i,j),0) . D(i,j) is the
distance between the spheres and R is the radius. pos is a 3-colum
matrix containging the coordinates of the position of each sphere

control=0;//number of
iterationssup_2(int(control/max_mov*20)+1)=sumsupant/max_mov*20;  //
this defines a third control system as will be described bellow. **
while max(superp)>tol  // the maximum value of superp controls when
the system is considered overlap-free and the algorithm is finished

...
// Several lines where the positions of each sphere are modified,
acording to the values of the matrix superp
...

superp=calc_D_superp_dobcel(pos);  //matrix superp is re-calculated
with the new positions

control=control+1;

 if control>max_mov then break; end   // control by maximum number of iterations

//the following belongs to the third control system:

if length(sup_2)==int(control/max_mov*20) then
sup_2(int(control/max_mov*20)+1)=sum(superp)/max_mov*20;//**
else//**
   sup_2(int(control/max_mov*20)+1)=sup_2(int(control/max_mov*20)+1)
+ sum(superp)/max_mov*20;   //**
   end //**

  if length(sup_2)>4.5 then//**
  if sup_2($-1)>0.85*sup_2($-2) & sup_2($-2)>0.85*sup_2($-3) then
break; end //**
  if sup_2($-1)>0.7*sup_2($-2) & sup_2($-2)>0.7*sup_2($-3) &
sup_2($-3)>0.6*sup_2($-4) then break; end//**
  end //**
end //ends while loop


The third control system essentially controls if the overlap is decreasing
as the iterations proceed. It defines a new variable, sup_2, that stores
the average value of sum(superp) in max_mov/20 iterations. If this average
does not decrease fast enough (>15% decrease in two or >30%decrease in
three consecutive groups of max_mov/20 iterations), it considers that it
will not converge and breaks.
Now, this third control system seems to be problem. As you can see, non of
its lines (marked with ** for more clarity), affects the values of superp
(at least, it shouldn´t). But still, the value of superp is modified when I
include this control system.
The other problem I had was with a similar algorithm, without the third
control system, but just adding a "pause" rigth after the last end. This
will also modify the values of superp and the number of iterations.
As I said, the error in superp is not important (it is in the order of
1.d-15), but this difference propagates exponentially through the
iterations and can significantly modify (like a 30%) the total number of
iterations (I was trying to evaluate if the third control really worked,
but I couldn´t do it because the algortihm CONVERGES with a different
number of iterations...)
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread constantina
yes, you're right, the correct word is "spike".  My problem consist: a matrix
like  [v,k1,k2], the first letter is "time", k1 and k2 are "values" of a
time series.
So... if I plot the values, Im gonna find "spikes" that means "errors,
happens the same with "zero" values... I have to eliminate the wrong values,
and I dont know how to do it, my teacher said that one way is find the
spikes and erase from the matrix, but I dont know how to do it , im newbie
with scilab and I tried with the method of Samuel, but I have problems with 
the size of the matrix (is evident in his example is 6x6) :/ , please any
suggestion?



--
View this message in context: 
http://mailinglists.scilab.org/Peaks-and-positions-tp4025764p4025809.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Serge Steer
If the initial position of your sphere are randomly set, it can be 
normal than you do not have the same number of iteration from one 
simulation to an other one.

can you check using
rand("seed",0)
to force identical initial points for your various tests.

Serge Steer
Le 28/01/2013 16:18, Ezequiel Soulé a écrit :
The algorithm essentially starts with a set of spheres in random 
positions and in a relatively dense state, and runs an iterative 
process where the spheres are moved in each iteration in order to 
reduce the overlaps.

The core of the script is more or less like this

superp=calc_D_superp_dobcel(pos);   //this line uses an external function 
to calculate a matrix with the overlap between paritcles, defined as 
superp(i,j)=max(R(i)+R(j)-D(i,j),0) . D(i,j) is the distance between the 
spheres and R is the radius. pos is a 3-colum matrix containging the 
coordinates of the position of each sphere

 control=0; //number of iterations


sup_2(int(control/max_mov*20)+1)=sumsupant/max_mov*20;   // this defines a 
third control system as will be described bellow. **

while  max(superp)>tol   // the maximum value of superp controls when the 
system is considered overlap-free and the algorithm is finished


...
// Several lines where the positions of each sphere are modified, acording to 
the values of the matrix superp
...
 
superp=calc_D_superp_dobcel(pos);   //matrix superp is re-calculated with the new positions



control=control+1;

  if  control>max_mov  then  break;  end// control by maximum number of 
iterations
  
//the following belongs to the third control system:
 
 if  length(sup_2)==int(control/max_mov*20)  then  sup_2(int(control/max_mov*20)+1)=sum(superp)/max_mov*20; //**

 else//**
sup_2(int(control/max_mov*20)+1)=sup_2(int(control/max_mov*20)+1)  +  
sum(superp)/max_mov*20;//**
end  //**
  
   if  length(sup_2)>4.5  then //**

   if  sup_2($-1)>0.85*sup_2($-2)  &  sup_2($-2)>0.85*sup_2($-3)  then  
break;  end  //**
   if  sup_2($-1)>0.7*sup_2($-2)  &  sup_2($-2)>0.7*sup_2($-3)  &  
sup_2($-3)>0.6*sup_2($-4)  then  break;  end //**
   end  //**

end//ends while loop

The third control system essentially controls if the overlap is 
decreasing as the iterations proceed. It defines a new variable, 
sup_2, that stores the average value of sum(superp) in max_mov/20 
iterations. If this average does not decrease fast enough (>15% 
decrease in two or >30%decrease in three consecutive groups of 
max_mov/20 iterations), it considers that it will not converge and breaks.
Now, this third control system seems to be problem. As you can see, 
non of its lines (marked with ** for more clarity), affects the values 
of superp (at least, it shouldn´t). But still, the value of superp is 
modified when I include this control system.
The other problem I had was with a similar algorithm, without the 
third control system, but just adding a "pause" rigth after the last 
end. This will also modify the values of superp and the number of 
iterations.
As I said, the error in superp is not important (it is in the order of 
1.d-15), but this difference propagates exponentially through the 
iterations and can significantly modify (like a 30%) the total number 
of iterations (I was trying to evaluate if the third control really 
worked, but I couldn´t do it because the algortihm CONVERGES with a 
different number of iterations...)



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Problem with ATOMS

2013-01-28 Thread Giovanni Tirelli
Hi, i've got the same error type in function "plot" of "scilab 5.4" running 
over "mountain lion"

e.g. (scilab help ode exampe)
function ydot=f(t, y)
ydot=y^2-y*sin(t)+cos(t)
endfunction
y0=0;
t0=0;
t=0:0.1:%pi;
y=ode(y0,t0,t,f);

plot(y,t)
executing with echo:

-->function ydot=f(t, y)
-->ydot=y^2-y*sin(t)+cos(t)
-->endfunction
-->y0=0;
-->t0=0;
-->t=0:0.1:%pi;
-->y=ode(y0,t0,t,f);
-->plot(y,t)
 !--error 42 
Oups. A fatal error has been detected by Scilab.
Your instance will probably crash soon.
Please report a bug on http://bugzilla.scilab.org/ with:
* a sample code which reproduces the issue
* the result of [a, b] = getdebuginfo()
* the following information:
[MacBook-2:50896] Signal: Abort trap: 6 (6)
[MacBooki-2:50896] Signal code:  (0)
 
Call stack:
   1: ??(?)
   2: 0x59dce
(/usr/lib/system/libsystem_c.dylib)
   3: 0x3a17 (/usr/lib/libc++abi.dylib)
   4: 0x13c6   <_ZL17default_terminatev>(/usr/lib/libc++abi.dylib)
   5: 0x11887  <_ZL15_objc_terminatev>  (/usr/lib/libobjc.A.dylib)
   6: 0x13f5   <_ZL19safe_handler_callerPFvvE>  (/usr/lib/libc++abi.dylib)
   7: 0x1450   <__cxa_bad_typeid>   (/usr/lib/libc++abi.dylib)
   8: 0x25b7   
<_ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception> 
(/usr/lib/libc++abi.dylib)
   9: 0x3c9d   
<_ZN34org_scilab_modules_graphic_objects21CallGraphicController18cloneGraphicObjectEP7JavaVM_PKc>
 
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscigraphic_objects.5.dylib)
  10: 0x2b3c7  
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscigraphics.5.dylib)
  11: 0x14a07  
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscigraphics.5.dylib)
  12: 0xb564   
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscigraphics.5.dylib)
  13: 0xd1e7   
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscigraphics.5.dylib)
  14: 0x1120a4 
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscilab-cli.0.dylib)
  15: 0x124be6 
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscilab-cli.0.dylib)
  16: 0x1200c2
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libscilab-cli.0.dylib)
  17: 0x1f4d   
(/Applications/scilab-5.4.0.app/Contents/MacOS/lib/scilab/libsciconsole.5.dylib)
  18: 0x14742  <_pthread_start> 
(/usr/lib/system/libsystem_c.dylib)
  19: 0x1181  
(/usr/lib/system/libsystem_c.dylib)
Fine dello stack


at line   2 of function gcf called by :  
at line 156 of function plot called by :  
plot(y,t)
at line   9 of exec file called by :
2079060681937290.sce', 1
while executing a callback
 
  !--error 999 
Annullamento del calcolo attuale


 Is it also a version problem or did I miss something in installation?





Il giorno 27/gen/2013, alle ore 22:54, René Grognard  ha 
scritto:

> In my professional work I had access and used MATLAB for many years.
> Now retired I have to switch to some free/less expensive equivalent
> software and I just downloaded Scilab that seems to offer more
> toolboxes.
> 
> However ATOMS does not seem to work.
> 
> My PC is a HP ProBook 4730s running Windows 7. (Cygwin 1.7 is
> installed and coud be used to run WScilex.exe.)
> 
> When I started Scilab-5.4.0 all appeared to be well:
> 
> Startup execution:
>  loading initial environment
> -->atomsSetConfig('Verbose','True')
> ans  =
>1.
> -->atomsGetConfig()
> ans  =
>   downloadTool: "curl"
>   Verbose: "True"
> 
> The  window Main categories - ATOMS was functional and allowed me to
> install say the Plotting library particularly promising to a MATLAB
> ex-user --- I get the message:
> 
> Installation done! Please restart Scilab to take changes into account.
> 
> OK restarting:
> 
> Startup execution:
>  loading initial environment
> 
> Start plotlib toolbox 0.43
> Load macros
> Load help
> 
>  !--error 999
> 'background' property does not exist for this handle.
> at line  46 of function uicontrol called by :
> at line 207 of function atomsGui called by :
> ms") then atomsGui(); else disp(gettext("
> while executing a callback
> 
> The error message itself seems garbled!
> 
> The next one seems clearer:
> 
> -->atomsGui()
> !--error 999
> 'background' property does not exist for this handle.
> at line  46 of function uicontrol called by :
> at line 207 of function atomsGui called by :
> atomsGui()
> 
> The window Main categories - ATOMS  which appears is now empty and
> indeed as "dead" as a dodo.
> 
> I checked that I have full control over the SCIHOME folder and its contents.
> 
> I regularly update the free JAVA which I believe is used by Scilab.
> 
> What did I do wrong/missed in installing Scilab-5.4.0?
> 
> Any help/info will be appreciated.
> 
> Regards,
> 
> Ren

Re: [Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Ezequiel Soule
Sorry I didn't clarify that: I define the initial random positions, I 
store them in a variable, say pos_in, and then I call the functions (the 
different versions) with pos_in as input, so the initial positions are 
the same in every case.


On 28/01/13 14:07, Serge Steer wrote:
If the initial position of your sphere are randomly set, it can be 
normal than you do not have the same number of iteration from one 
simulation to an other one.

can you check using
rand("seed",0)
to force identical initial points for your various tests.

Serge Steer
Le 28/01/2013 16:18, Ezequiel Soulé a écrit :
The algorithm essentially starts with a set of spheres in random 
positions and in a relatively dense state, and runs an iterative 
process where the spheres are moved in each iteration in order to 
reduce the overlaps.

The core of the script is more or less like this

superp=calc_D_superp_dobcel(pos);   //this line uses an external function 
to calculate a matrix with the overlap between paritcles, defined as 
superp(i,j)=max(R(i)+R(j)-D(i,j),0) . D(i,j) is the distance between the 
spheres and R is the radius. pos is a 3-colum matrix containging the 
coordinates of the position of each sphere

 control=0; //number of iterations


sup_2(int(control/max_mov*20)+1)=sumsupant/max_mov*20;   // this defines a 
third control system as will be described bellow. **

while  max(superp)>tol   // the maximum value of superp controls when the 
system is considered overlap-free and the algorithm is finished


...
// Several lines where the positions of each sphere are modified, acording to 
the values of the matrix superp
...
 
superp=calc_D_superp_dobcel(pos);   //matrix superp is re-calculated with the new positions



control=control+1;

  if  control>max_mov  then  break;  end// control by maximum number of 
iterations
  
//the following belongs to the third control system:
 
 if  length(sup_2)==int(control/max_mov*20)  then  sup_2(int(control/max_mov*20)+1)=sum(superp)/max_mov*20; //**

 else//**
sup_2(int(control/max_mov*20)+1)=sup_2(int(control/max_mov*20)+1)  +  
sum(superp)/max_mov*20;//**
end  //**
  
   if  length(sup_2)>4.5  then //**

   if  sup_2($-1)>0.85*sup_2($-2)  &  sup_2($-2)>0.85*sup_2($-3)  then  
break;  end  //**
   if  sup_2($-1)>0.7*sup_2($-2)  &  sup_2($-2)>0.7<
  span styl
e="color:rgb(92,92,92)">*sup_2($-3)  &  sup_2($-3)>0.6*sup_2($-4)  then  break; 
 end //**
   end  //**

end//ends while loop

The third control system essentially controls if the overlap is 
decreasing as the iterations proceed. It defines a new variable, 
sup_2, that stores the average value of sum(superp) in max_mov/20 
iterations. If this average does not decrease fast enough (>15% 
decrease in two or >30%decrease in three consecutive groups of 
max_mov/20 iterations), it considers that it will not converge and 
breaks.
Now, this third control system seems to be problem. As you can see, 
non of its lines (marked with ** for more clarity), affects the 
values of superp (at least, it shouldn´t). But still, the value of 
superp is modified when I include this control system.
The other problem I had was with a similar algorithm, without the 
third control system, but just adding a "pause" rigth after the last 
end. This will also modify the values of superp and the number of 
iterations.
As I said, the error in superp is not important (it is in the order 
of 1.d-15), but this difference propagates exponentially through the 
iterations and can significantly modify (like a 30%) the total number 
of iterations (I was trying to evaluate if the third control really 
worked, but I couldn´t do it because the algortihm CONVERGES with a 
different number of iterations...)



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users




___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Help files seem to be missing.

2013-01-28 Thread ledlighter
I reinstalled Scilab and everything works fine now. The new features and
environment in this version are very nice. Thanks to all those who
contributed to its development. As a user only, I am grateful.  Best
regards.



--
View this message in context: 
http://mailinglists.scilab.org/Help-files-seem-to-be-missing-tp4025741p4025815.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread Berns Buenaobra
Hi Samuel:

I'd like to understand  the "$" inside the would mean from the script?

Thanks,
Berns B.


On Sun, Jan 27, 2013 at 12:46 AM, Samuel Gougeon  wrote:

>  Le 26/01/2013 17:00, constantina a écrit :
>
> Sorry, I know is a basic question, i now the answer in matlab but not in
> scilab What is the function that let me find "peaks " in a matrix and
> the position of the peaks???
>
>  Here is a possible solution, including peaks on the borders:
>
> m = rand(6,6)
> M = [m(2,:) ; m ; m($-1,:) ];
> M = [M(:,2)  M  M(:,$-1)];
> pC = M(2:$-1,2:$-1)>M(1:$-2,2:$-1) & M(2:$-1,2:$-1)>M(3:$,2:$-1);
> pR = M(2:$-1,2:$-1)>M(2:$-1,1:$-2) & M(2:$-1,2:$-1)>M(2:$-1,3:$);
> isPeak = pC & pR
> find(isPeak)  // returns linearized indices of peaks
> m(~isPeak) = 0 //  to show only peaks
>
> giving:
>
> -->m = rand(6,6)
>  m  =
> 0.04373340.77831290.84155180.56186610.3873779
> 0.2615761
> 0.48185090.21190300.40620250.58961770.9222899
> 0.4993494
> 0.26395560.11213550.40948250.68539800.9488184
> 0.2638578
> 0.41481040.68568960.87841260.89062250.3435337
> 0.5253563
> 0.28064980.15312170.11383600.50422130.3760119
> 0.5376230
> 0.12800580.69708510.19983380.34936150.7340941
> 0.1199926
>
> -->M = [m(2,:) ; m ; m($-1,:) ];
> -->M = [M(:,2)  M  M(:,$-1)];
> -->pC = M(2:$-1,2:$-1)>M(1:$-2,2:$-1) & M(2:$-1,2:$-1)>M(3:$,2:$-1);
> -->pR = M(2:$-1,2:$-1)>M(2:$-1,1:$-2) & M(2:$-1,2:$-1)>M(2:$-1,3:$);
> -->isPeak = pC & pR
>  isPeak  =
>   F F T F F F
>   T F F F F F
>   F F F F T F
>   F F F T F F
>   F F F F F T
>   F T F F T F
>
> -->find(isPeak)  // returns linearized indices of peaks
>  ans  =
> 2.12.13.22.27.30.35.
>
> -->m(~isPeak) = 0 //  to show only peaks
>  m  =
> 0.   0.   0.84155180.   0.
> 0.
> 0.48185090.   0.   0.   0.
> 0.
> 0.   0.   0.   0.   0.9488184
> 0.
> 0.   0.   0.   0.89062250.
> 0.
> 0.   0.   0.   0.   0.
> 0.5376230
> 0.   0.69708510.   0.   0.73409410.
>
>
> Regards
> Samuel
>
>
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread Stefan Du Rietz

It means the last element of the vector/matrix.

/Stefan

On 2013-01-28 22:30, Berns Buenaobra wrote:


Hi Samuel:

I'd like to understand  the "$" inside the would mean from the script?

Thanks,
Berns B.


On Sun, Jan 27, 2013 at 12:46 AM, Samuel Gougeon mailto:sgoug...@free.fr>> wrote:

Le 26/01/2013 17:00, constantina a écrit :

Sorry, I know is a basic question, i now the answer in matlab but not in
scilab What is the function that let me find "peaks " in a matrix and
the position of the peaks???

Here is a possible solution, including peaks on the borders:

m = rand(6,6)
M = [m(2,:) ; m ; m($-1,:) ];
M = [M(:,2)  M  M(:,$-1)];
pC = M(2:$-1,2:$-1)>M(1:$-2,2:$-1) & M(2:$-1,2:$-1)>M(3:$,2:$-1);
pR = M(2:$-1,2:$-1)>M(2:$-1,1:$-2) & M(2:$-1,2:$-1)>M(2:$-1,3:$);
isPeak = pC & pR
find(isPeak)  // returns linearized indices of peaks
m(~isPeak) = 0 //  to show only peaks

giving:

-->m = rand(6,6)
  m  =
 0.04373340.77831290.84155180.5618661 0.3873779
0.2615761
 0.48185090.21190300.40620250.5896177 0.9222899
0.4993494
 0.26395560.11213550.40948250.6853980 0.9488184
0.2638578
 0.41481040.68568960.87841260.8906225 0.3435337
0.5253563
 0.28064980.15312170.11383600.5042213 0.3760119
0.5376230
 0.12800580.69708510.19983380.3493615 0.7340941
0.1199926

-->M = [m(2,:) ; m ; m($-1,:) ];
-->M = [M(:,2)  M  M(:,$-1)];
-->pC = M(2:$-1,2:$-1)>M(1:$-2,2:$-1) & M(2:$-1,2:$-1)>M(3:$,2:$-1);
-->pR = M(2:$-1,2:$-1)>M(2:$-1,1:$-2) & M(2:$-1,2:$-1)>M(2:$-1,3:$);
-->isPeak = pC & pR
  isPeak  =
   F F T F F F
   T F F F F F
   F F F F T F
   F F F T F F
   F F F F F T
   F T F F T F

-->find(isPeak)  // returns linearized indices of peaks
  ans  =
 2.12.13.22.27.30.35.

-->m(~isPeak) = 0 //  to show only peaks
  m  =
 0.   0.   0.84155180. 0.   0.
 0.48185090.   0.   0. 0.   0.
 0.   0.   0.   0. 0.94881840.
 0.   0.   0.   0.8906225 0.   0.
 0.   0.   0.   0. 0.   0.5376230
 0.   0.69708510.   0. 0.73409410.


Regards
Samuel



___
users mailing list
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users




___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users




___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread Samuel Gougeon

Le 28/01/2013 22:30, Berns Buenaobra a écrit :

Hi Samuel:

I'd like to understand  the "$" inside the would mean from the script?

This is the size of the object along the related direction:
http://help.scilab.org/docs/5.4.0/en_US/dollar.html

after
a = ones(7,3)
a(:,$) // is equivalent to a(:,3)
a($-2,:)  // is equivalent to a(5,:)

$ can be used for any type of object: lists, structures, cells,
and obviously matrices and hypermatrices:

L = list("Hello", %pi, (%z-1)^2)
L($)  // returns the polynomial (%z-1)^2 = the last element of L
// To append a element to L, just use(for instance)
L($+1) = %T

$ can also be seen as a measurement of the money that you save when
using Scilab. But this is another undocumented story ;)

Samuel
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] modifying a variable changes the value of another variable!!!

2013-01-28 Thread Rafael Guerra

>From the code excerpt provided it is difficult to see from where errors of
magnitude~=1e-15 might come from.

Could they be due to some round-off errors in the function:
calc_D_superp_dobcel? Please check the function details.

Have you run the code with a "clear" at the beginning of the program to
clean all variables?

// Could you please define before your 3rd control system:
   superp0= superp;
// and after your 3rd control system:
   superp1= superp;
   printf("%i...delta(superp) = %e", control, max(abs(superp1-superp0)) )
// and tell us what values do you get? Do the errors of 1e-15 magnitude
occur and at which "control" iterations?


// Non related to your problem, herebelow are some suggestions, if you will,
to make your code more easy to read:

   //define additional variables to simplify the code:
   m = int(control/max_mov*20);
   N = length(sup_2);
   s = sum(superp);

   // write:
   while max(superp)>tol & control<=max_mov // moving "control=control+1" to
the end of the while loop


PS: "sumsupant"  // this variable is not defined in the code excerpt, looks
like =sum(superp)


Regards,
Rafael G.



--
View this message in context: 
http://mailinglists.scilab.org/modifying-a-variable-changes-the-value-of-another-variable-tp4025762p4025819.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Peaks and positions

2013-01-28 Thread Berns Buenaobra
Thanks! Understood much better to ask some experienced fellow than dig in
the pile of hay.

Berms B.


On Tue, Jan 29, 2013 at 6:03 AM, Samuel Gougeon  wrote:

> Le 28/01/2013 22:30, Berns Buenaobra a écrit :
>
>  Hi Samuel:
>>
>> I'd like to understand  the "$" inside the would mean from the script?
>>
> This is the size of the object along the related direction:
> http://help.scilab.org/docs/5.**4.0/en_US/dollar.html
>
> after
> a = ones(7,3)
> a(:,$) // is equivalent to a(:,3)
> a($-2,:)  // is equivalent to a(5,:)
>
> $ can be used for any type of object: lists, structures, cells,
> and obviously matrices and hypermatrices:
>
> L = list("Hello", %pi, (%z-1)^2)
> L($)  // returns the polynomial (%z-1)^2 = the last element of L
> // To append a element to L, just use(for instance)
> L($+1) = %T
>
> $ can also be seen as a measurement of the money that you save when
> using Scilab. But this is another undocumented story ;)
>
>
> Samuel
> __**_
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/**mailman/listinfo/users
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users