Re: [Scilab-users] [EXTERNAL] Re: submatrix issue

2018-06-03 Thread paul . carrico
Hi Rafael, 

Thanks for your interest,; I think I was wrong in my way of using 3
vectors at the same time, 

To answer to your question, the structure is 

N = Node number 

2/3 = number of coordinates (2 for 2D and 3 for 3D obviously) 

X 

Y 

(Z) if in 3D 

[same structure for all the nodes] 

Obviously I can use a loop, but vectorization is more efficient; I was
thinking on a generic code that works for all the configuration .. the
silmpliest way is to check since the beginning if we are in 3D or not,
and to add anorther line if necessary: 

- one vector to get the node number 

- one for X and one for Y 

if we are in 3D, then a new vector dealing to Z will be added 

I'll have a look on it tomorrow :-) 

Regards 

Paul 

Le 2018-06-03 15:56, Rafael Guerra a écrit :

> Paul, 
> 
> Does your input ASCII file have N-lines with 3-values on each row: 
> 
> X1 Y1 Z1 
> 
> X2 Y2 Z2 
> 
> … 
> 
> or instead, does it have one value per row over Nx3 rows: 
> 
> X1 
> 
> Y1 
> 
> Z1 
> 
> X2 
> 
> Y2 
> 
> Z2 
> 
> … 
> 
> ? 
> 
> Regards, 
> 
> Rafael 
> 
> ___
> 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] unable to read a hdf5 file under windows

2018-03-19 Thread paul . carrico
I finally found what went wrong… a latin letter in the path with 'é' … 

Now it works ... sorry 

Paul 

Le 2018-03-19 13:00, amonm...@laas.fr a écrit :

> Le 19/03/2018 à 11:35, paul.carr...@free.fr a écrit : 
> 
>> Hi All 
>> 
>> I'm still wondering why I cannot open a hdf5 file under windows, while it 
>> works find under linux 
>> 
>> (I'm using the latest scilab release in both cases - hdf5 file was made 
>> using h5py librarie) 
>> 
>> The path & file name are corect, so ? 
>> 
>> Any trouble under windows? 
>> 
>> Paul 
>> 
>> 
>> 
>> PATH = get_absolute_file_path("test_read_hdf5.sce");
>> fichier = "Results_gzip.h5";
>> resu = h5open(PATH + fichier);
>> 
>> h5open : Impossible d'ajouter des données au fichier (non HDF5) : 
>> D:\***\Results_gzip.h5.
>> Description HDF5: unable to open file: name = 'D:\***\Results_gzip.h5', 
>> errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 
>> 0. 
>> 
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> 
> That's weird.
> Can you share a small hdf5 file that exhibits this problem?
> I might try to read it from linux/windows.
> The only windows-specific hdf5 bug I am aware of is related to unknown types 
> for some integers.
> Are you sure your problem is not something related to the difference in path 
> definition & handling between linux and windows? 
> 
> Antoine 
> 
> ___
> 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


[Scilab-users] unable to read a hdf5 file under windows

2018-03-19 Thread paul . carrico
Hi All 

I'm still wondering why I cannot open a hdf5 file under windows, while
it works find under linux 

(I'm using the latest scilab release in both cases - hdf5 file was made
using h5py librarie) 

The path & file name are corect, so ? 

Any trouble under windows? 

Paul 



PATH = get_absolute_file_path("test_read_hdf5.sce");
fichier = "Results_gzip.h5";
resu = h5open(PATH + fichier);

h5open : Impossible d'ajouter des données au fichier (non HDF5) :
D:\***\Results_gzip.h5.
Description HDF5: unable to open file: name = 'D:\***\Results_gzip.h5',
errno = 2, error message = 'No such file or directory', flags = 0,
o_flags = 0.___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] hdf5 format and

2018-02-28 Thread paul . carrico
Hi 

In the following example, I'm digging into the Scilab help pages in
order to understand how I can use hdf5 format; nevertheless I'm still
wondering how I can have access to the sub-structure (sub-groups and
datasets on them) ? 

(I'm thinking in programming recursive search ...) 

Thanks 

Paul 

###

mode(0)

PATH = get_absolute_file_path("test_hdf5.sce");

// the new file is created
a = h5open(PATH + "/tests.h5", "w");

// a basic group is created
group_name = "MyGroup";
h5group(a, group_name);

// sub-groups creation (using a loop)
for i = 1 : 10
s = group_name + "/sub_group" + string(i);
h5group(a,s)
end

// specific groups & sub-groups
h5group(a, "FEM");
h5group(a, "FEM/NODES");
h5group(a, "FEM/ELEMENTS");

// dataset creation using a data matrix
n = 1E3;
i = (1:n)';
A = rand(n,3);
Nodes = zeros(n,4);
Nodes(:,1) = i;
Nodes(:,2:4) = A;
h5write(a,"NODES",Nodes'); // dataset name is NODES here - do not
confuse with the sub-group
h5write(a,"FEM/NODES2",Nodes'); // dataset name is NODE2 in FEM group
h5write(a,"FEM/NODES/new_nodes",Nodes'); // add of a new dataset names
"new_nodes" in the subgroup NODES in FEM

// tests on the contect of the file (see H objects)
// it's expected to find sub-groups and dataset into them
a.root // list of the groups / datasets and so on at the root
a.root.datasets // specifically list of the datasets

a.root.NODES // provides information's of the "NODES" dataset

a("/FEM")
a("/FEM").datasets
a("/FEM/NODES").datasets

//pause h5close(a);___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Scilab and hdf5 format (small survey)

2018-02-28 Thread paul . carrico
Hi All  

I'm playing with hdf5 format into Scilab (I'm currently in an early
stage that consists in understanding what the structures are); the goal
is to deal with huge amount of data coming from Finite Element Analyses,
and to perform additional calculations. 

I'm wondering if there are a lot of people working with Hdf5 file into
Scilab? in what fields? 

(behind this, a goal among others  is to get feedbacks from them on
advantages and disadvantages). 

Regards 

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


[Scilab-users] Dark theme

2018-02-27 Thread paul . carrico
Dear All, 

White background involves eye fatigue (for me at least) and I'm
wondering if a "dark theme" exists .. I had a look in scinote - maybe
I'm missing something (of course one can change the color in sconotre
preferences, but it's not convinient in my mind). 

Thanks 

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


Re: [Scilab-users] OpenFEM

2018-02-06 Thread paul . carrico
Thanks Clément 

I saw it, but I've been thinking that a more recent release may exist
(in some personal archives?) 

Paul 

e 2018-02-06 17:37, Clément David a écrit :

> Hello Paul,
> 
> May be at INRIA GForge [1 [1]] ?
> 
> [1]: https://gforge.inria.fr/projects/openfem/
> 
> --
> Clément
> 
> Le vendredi 02 février 2018 à 08:59 +0100, paul.carr...@free.fr a écrit : 
> 
>> Dear All,
>> OpenFEM project seems to be dead ; the links do not work anymore 
>> (http://www.openfem.net/t/ and ht
>> tps://support.sdtools.com/gf/project/openfem).
>> For my culture, does somebody has the latest release in its archives?
>> Thanks
>> Paul
>> ___
>> 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

 

Links:
--
[1] https://gforge.inria.fr/projects/openfem/___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] OpenFEM

2018-02-02 Thread paul . carrico
Dear All, 

OpenFEM project seems to be dead ; the links do not work anymore
(http://www.openfem.net/ and
https://support.sdtools.com/gf/project/openfem). 

For my culture, does somebody has the latest release in its archives? 

Thanks 

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


Re: [Scilab-users] {EXT} string and excestr

2018-01-22 Thread paul . carrico
Thanks Christophe, 

It means that some codes I made last few years are not available now
under Scilab6.0 :-( 

A personal reflexion is in progress consequently ... 

Paul 

Le 2018-01-22 18:08, Dang Ngoc Chan, Christophe a écrit :

> Hello Paul,
> 
>> De la part de Carrico, Paul
>> Envoyé : lundi 22 janvier 2018 15:09
>> 
>> In the past, I used the following structure to develop my code on several 
>> lines (until the release 5.5.2) ;
>> in the new one, the 3 dots do not work anymore.
> 
> I also noticed some changes with the continuation dots, see :
> 
> http://mailinglists.scilab.org/Scilab-users-Weird-things-with-the-continuation-dots-td4037181.html
> 
> 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___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Advice needed on file parsing

2017-06-18 Thread paul . carrico
Hi 

I cannot say if the following is the best way to proceed, but when the
number of columns differs, I always have a look to such functions in
order to get the data: mopen/mgetl/grep/strindex and so on ... it need a
bit of work. 

The previous method work when the file size is not huge because mgetl
loads in memory all the file first - in case of huge files (I mean with
millions of lines), I need to adopt another strategy (bash file using
awk - grep - seb and so on tool) in order to have a text/matrix file in
a right format ... nevertheless I do not get strings so the previous
method may not work. 

Just a feedback 

Paul 

Le 2017-06-18 23:10, Richard llom a écrit : 

> Hello fellow scilab-users,
> I'm writing a script to read and process files, which are constructed as
> follows:
> 
> PCB: 007
> ASM: 000
> LOT: 0
> FW:  1477971088
> CH1:  AMPS   10A
> CH2:  VOLT   60V
> SMPL: 0064 0125Hz
> DESC: 12V CU LOG
> UTC TIME SEC  ,CH1 AMPS DC  ,CH2 VOLT DC  
> 1497812372.910, 8.609146E-03, 1.210613E001
> 1497812373.895, 1.577809E-01, 1.207540E001
> 1497812374.578, 1.010268E000, 1.193087E001
> ... [snip]
> 
> 
> To process this file further, I need:
> 1)
> the first eight lines stored in pairs, e.g. 
> info(1,1) should yield "PCB" and info(1,2) should yield "007" (string is ok)
> 
> 2)
> line #9 (header), should be available as header(1)="UTC TIME SEC", etc...
> 
> 3)
> line 10+
> these should be scanned in as a matrix.
> 
> I already tried csvread and msscanf (?), however with no luck so far...
> 
> So if someone could just point me to the apropiates function for each task.
> I hopefully can take it then from there.
> Thanks & cheers
> richard
> 
> --
> View this message in context:
> http://mailinglists.scilab.org/Advice-needed-on-file-parsing-tp4036587.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] basic question ?

2017-04-23 Thread paul . carrico
Thanks for your answer 

I found another way ... not necessarily better than your one and
probably more costly :-( 

Paul 
###" 

n = 10;

A = rand(n,6);
B = zeros((2*n),2); 

// goal is to get the value of the 1rst and 4th column
i = [1 : n]';
j = [1 : 2 : 2*n]';
k = [2 : 2 : 2*n]';

// tmp = [i j k]

i = [1 : n]';
j = [1 : 2 : 2*n]';
k = [2 : 2 : 2*n]';

B(j,1) = A(i,1);
B(k,1) = A(i,4);

Le 2017-04-23 22:59, Tim Wescott a écrit : 

> This is horrible, but should do what you intend:
> 
> B(i,1) = A(j + size(A, 1) * (k - 1));
> 
> It works because you can address a 2D matrix as a 1D matrix, with A(1)
> == A(1, 1), A(2) = A(2, 1), A(size(A, 1) + 1) = A(1, 2), etc.
> 
> On Sun, 2017-04-23 at 22:25 +0200, paul.carr...@free.fr wrote: 
> 
>> Hi All
>> 
>> I'm sorry if my question is "basic", but I've not understood why the
>> following code does not work ... size of i,j,k seems correct
>> 
>> Do I miss something?
>> 
>> Thanks for your time
>> 
>> Paul
>> 
>> ##
>> mode(0)
>> 
>> n = 10;
>> 
>> A = rand(n,6);
>> B = zeros((2*n),2); C = B;
>> 
>> // goal is to get the value of the 1rst and 4th column in 2 lines
>> i = [1 : (2*n)]';
>> j = [1 : n]'.*.ones(2,1); // gives [1 1 2 2 3 3  n n]'
>> k = ones(n,1).*.[1 4]';  // gives [1 4 1 4 1 4  1 4]'
>> 
>> tmp = [i j k] // to visualize the indexes
>> 
>> //B(i,1) = A(j,k); // does not work??
>> C(1,1) = A(1,1);
>> C(2,1) = A(1,4);
>> C
>> A
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> -- 
> 
> Tim Wescott
> www.wescottdesign.com [1]
> Control & Communications systems, circuit & software design.
> Phone: 503.631.7815
> Cell:  503.349.8432
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
 

Links:
--
[1] http://www.wescottdesign.com___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] basic question ?

2017-04-23 Thread paul . carrico
Hi All

I'm sorry if my question is "basic", but I've not understood why the
following code does not work ... size of i,j,k seems correct 

Do I miss something? 

Thanks for your time 

Paul

## 

mode(0)

n = 10;

A = rand(n,6);
B = zeros((2*n),2); C = B;

// goal is to get the value of the 1rst and 4th column in 2 lines
i = [1 : (2*n)]';
j = [1 : n]'.*.ones(2,1); // gives [1 1 2 2 3 3  n n]'
k = ones(n,1).*.[1 4]';  // gives [1 4 1 4 1 4  1 4]'

 tmp = [i j k] // to visualize the indexes

//B(i,1) = A(j,k); // does not work??
C(1,1) = A(1,1);
C(2,1) = A(1,4);
C
A___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] fsolve including linear interpolation

2017-04-18 Thread paul . carrico
the example I built is not relevant and it does not reflect the problem
behind... sorry for the inconvenient 

Paul 

Le 2017-04-18 17:20, roger.corm...@ncf.ca a écrit : 

> Paul:
> 
> It appears that you're solving for y given theta and x, but y is a
> linear function of theta and x.
> 
> I don't have a good knowledge of what you are trying to solve, but
> when I solve nonlinear problems I normally either have a form of
> first-order derivative (scalar or a Jacobian), or some form of
> branching/discontinuity from which I need to choose the "best"
> solution. For linear interpolation, I find that it's easier to simply
> write a function myself than try to figure out how to make a given
> built-in function works.
> 
> I'm going fishing here: in your function, theta is 8x1 but your
> arguments for interpl are theta(:,1),theta(:,2), which presumes that
> theta is 8x2, so that could be a place to start looking at why fsolve
> is giving your grief.
> 
> Regards,
> 
> Roger.
> 
> __
> Dr. Roger Cormier, P.Eng.
> Home Tel. & Fax: 613-823-7299
> 
> Am mar. 18 avr. 2017 um 09:03 schrieb paul.carr...@free.fr:
> 
>> Hi All
>> 
>> I'm wondering what is the way to solve the following study (but at the same 
>> time I'm not sure that the problem has been correctly posed) ... I'm a bit 
>> "disrupted" by theta scalar that depends itself on x value.
>> 
>> The problem seems to be non linear and I tried (but I failed) in using 
>> fsolve.
>> 
>> Any suggestion where I've to see to?
>> 
>> Thanks for your time and help
>> 
>> Paul
>> 
>> #
>> function y=calculus(x)
>> 
>> theta = [ 1 100 200 300
>> 
>> 1000 1200 1500 2000]';
>> 
>> theta_interp = interp1(theta(:,1),theta(:,2),x,'linear');
>> 
>> y = -theta_interp * 0.268 + 120 -x; //pause
>> 
>> // if theta = 1 : y = 0 -> x = 120 - 0.268 = 119.73
>> 
>> // if theta = 100 : y = 0 -> x = 120 - 26.8 = 93.2
>> 
>> // if theta = 200 : x = 66.4
>> 
>> // if theta = 300 : x = 120 - 0.268 = 39.6
>> 
>> // can we say that y belongs to [39.6 , 119.73] ?
>> 
>> endfunction
>> 
>> [x,v,info] = fsolve(0,calculus)
>> 
>> ___
>> 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


[Scilab-users] fsolve including linear interpolation

2017-04-18 Thread paul . carrico
Hi All

I'm wondering what is the way to solve the following study (but at the
same time I'm not sure that the problem has been correctly posed) ...
I'm a bit "disrupted" by theta scalar that depends itself on x value. 

The problem seems to be non linear and I tried (but I failed) in using
fsolve. 

Any suggestion where I've to see to? 

Thanks for your time and help 

Paul 

# 

function y=calculus(x)   
theta = [ 1 100 200 300
1000 1200 1500 2000]'; 

theta_interp = interp1(theta(:,1),theta(:,2),x,'linear');
y = -theta_interp * 0.268 + 120 -x; //pause

// if theta = 1 : y = 0 -> x = 120 - 0.268 = 119.73
// if theta = 100 : y = 0 -> x = 120 - 26.8 = 93.2
// if theta = 200 : x = 66.4
// if theta = 300 : x = 120 - 0.268 = 39.6

// can we say that y belongs to [39.6 , 119.73] ?

endfunction

[x,v,info] = fsolve(0,calculus)___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] contour : z level use

2017-04-02 Thread paul . carrico
amazing ... once again many thanks Rafael 

(need time to have a look on the code and to catch how to modify some
features) 

Thanks 

Paul 

Le 2017-04-02 14:49, Rafael Guerra a écrit : 

> // NOTE: the previous contour code line should read:
> contour(X,Y,Z,[Zc Zc],flag=[0 0 4]);
> 
> --
> View this message in context:
> http://mailinglists.scilab.org/Scilab-users-contour-z-level-use-tp4036103p4036109.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] contour : z level use

2017-04-02 Thread paul . carrico
Hi Samuel 

Even when using mode = 1 (as the other in fact) in the flag,  the result
remains identical 

_Nb_: I probably pasted the latest trial I did :-) 

Paul 

// flag=[mode,type,box]
// mode : //string representation mode.
   //mode=0: the level curves are drawn on the surface defined by
(x,y,z).
   //mode=1: the level curves are drawn on a 3D plot and on the plan
defined by the equation z=zlev.
   //mode=2: the level curves are drawn on a 2D plot.

//type : an integer (scaling).
   //type=0 : the plot is made using the current 3D scaling (set by
a previous call to param3d, plot3d, contour or plot3d1).
   //type=1 : rescales automatically 3d boxes with extreme aspect
ratios, the boundaries are specified by the value of the optional
argument ebox.
   //type=2 : rescales automatically 3d boxes with extreme aspect
ratios, the boundaries are computed using the given data.
   //type=3 : 3d isometric with box bounds given by optional ebox,
similarily to type=1
   //type=4 : 3d isometric bounds derived from the data, to
similarily type=2
   //type=5 : 3d expanded isometric bounds with box bounds given by
optional ebox, similarily to type=1
   //type=6 : 3d expanded isometric bounds derived from the data,
similarily to type=2

//box : an integer (frame around the plot).
   //box=0 : nothing is drawn around the plot.
   //box=1 : unimplemented (like box=0).
   //box=2 : only the axes behind the surface are drawn.
   //box=3 : a box surrounding the surface is drawn and captions are
added.
   //box=4 : a box surrounding the surface is drawn, captions and
axes are added.

//ebox : used when type in flag is 1. It specifies the boundaries of the
plot as the vector [xmin,xmax,ymin,ymax,zmin,zmax].

//zlev : real number.

Le 2017-04-02 12:56, Samuel Gougeon a écrit : 

> Hello,
> 
>> contour(X,Y,Z,1,flag=[0 1 4],zlev=0.);
> 
> You are setting an inappropriate mode in flag.
> 
> Samuel
> 
> Le 02/04/2017 à 09:16, paul.carr...@free.fr a écrit :
> 
> Hi
> 
> I've been thinking that Scilab uses the closest zlev than the one
> I'm specifying, based on the points I provided ... am I correct?
> 
> I've to find a way to create the points I need with z=0 
> 
> Paul
> 
> Le 2017-04-01 23:42, paul.carr...@free.fr a écrit :
> 
> Hi
> 
> In the following example, I'm trying to add a single contour line
> equals to z = 0, but I've another value: what am I doing wrong?
> 
> Thanks for the help
> 
> Nota bene : I'm under 5.5.2 Scilab release
> 
> Paul
> 
> ##
> 
> mode(0)
> 
> X = linspace(0,1,10);
> Y = linspace(0,1,10);
> Z = rand(10,10) - rand(10,10);
> 
> Z_min = min(Z);
> Z_max = max(Z);
> 
> //  plot3d
> 
> scf();
> xset("colormap",jetcolormap(64));
> drawlater() ;
> xtitle("Z following (X,Y)");
> colorbar(Z_min,Z_max);
> a=get("current_axes");
> a.x_label; x_label=a.x_label; x_label.text=" X";
> a.y_label; y_label=a.y_label; y_label.text=" Y";
> a.z_label; z_label=a.z_label; z_label.text=" Z";
> plot3d1(X,Y,Z,45,80);
> contour(X,Y,Z,1,flag=[0 1 4],zlev=0.);
> drawnow() ;
> ___
 ___
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] contour : z level use

2017-04-02 Thread paul . carrico
Hi 

I've been thinking that Scilab uses the closest zlev than the one I'm
specifying, based on the points I provided ... am I correct? 

I've to find a way to create the points I need with z=0  

Paul 

Le 2017-04-01 23:42, paul.carr...@free.fr a écrit : 

> Hi 
> 
> In the following example, I'm trying to add a single contour line
> equals to z = 0, but I've another value: what am I doing wrong? 
> 
> Thanks for the help 
> 
> Nota bene : I'm under 5.5.2 Scilab release 
> 
> Paul 
> 
> ##
> 
> mode(0)
> 
> X = linspace(0,1,10);
> Y = linspace(0,1,10);
> Z = rand(10,10) - rand(10,10);
> 
> Z_min = min(Z);
> Z_max = max(Z);
> 
> //  plot3d
> 
> scf();
> xset("colormap",jetcolormap(64)); 
> drawlater() ;
> xtitle("Z following (X,Y)");
> colorbar(Z_min,Z_max); 
> a=get("current_axes");
> a.x_label; x_label=a.x_label; x_label.text=" X";
> a.y_label; y_label=a.y_label; y_label.text=" Y";
> a.z_label; z_label=a.z_label; z_label.text=" Z";
> plot3d1(X,Y,Z,45,80);
> contour(X,Y,Z,1,flag=[0 1 4],zlev=0.);
> drawnow() ;
> ___
> 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


[Scilab-users] contour : z level use

2017-04-01 Thread paul . carrico
Hi 

In the following example, I'm trying to add a single contour line equals
to z = 0, but I've another value: what am I doing wrong? 

Thanks for the help 

Nota bene : I'm under 5.5.2 Scilab release 

Paul 

##

mode(0)

X = linspace(0,1,10);
Y = linspace(0,1,10);
Z = rand(10,10) - rand(10,10);

Z_min = min(Z);
Z_max = max(Z);

//  plot3d

scf();
xset("colormap",jetcolormap(64)); 
drawlater() ;
xtitle("Z following (X,Y)");
colorbar(Z_min,Z_max); 
a=get("current_axes");
a.x_label; x_label=a.x_label; x_label.text=" X";
a.y_label; y_label=a.y_label; y_label.text=" Y";
a.z_label; z_label=a.z_label; z_label.text=" Z";
plot3d1(X,Y,Z,45,80);
contour(X,Y,Z,1,flag=[0 1 4],zlev=0.);
drawnow() ;___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Plots on second Y axis

2017-03-28 Thread paul . carrico
Thanks for sharing it. 

I've a suggestion I commonly use for such plots (I'm speaking in a
general way): the color of the dedicated ordinate axis is the same than
the curve in order to immediatly know what are the units and where to
look to ... 
... just my point of view 

Paul 

Le 2017-03-28 09:51, mathias_magdowski a écrit : 

> I have extended the given example in a way that the left and right y axis get
> some kind of intelligent equal scaling, so that a joined grid for both axes
> would fit. If one of the axes includes the value of y = 0, both axes will
> also share the same "base line".
> 
> Here is the function:
> 
> // Function for plotting a diagram with two y axes
> // Input:
> //  x  - x values -> vector
> //  y1 - y values for the  for the left y axis -> vector
> //  y2 - y values for the right y axis -> vector
> // Output:
> //  a1, a2 - axes -> handle
> function [a1,a2]=plotyy(x,y1,y2)
> // example for a diagram with two y axes
> // see:
> https://commons.wikimedia.org/wiki/File:Trace_ln_sqrt_1_2_deux_echelles_scilab.svg
> // and:  
> http://mailinglists.scilab.org/Scilab-users-Plots-on-second-Y-axis-td4025895.html
> // generation of the right y axis
> a1=newaxes();
> a1.tight_limits=["on","off","off"];
> // plot of the first function
> plot(x,y1);
> // generation of the right y axis
> a2=newaxes();
> // no background for this plot
> a2.filled="off";
> // hide second x axis
> a2.axes_visible(1)="off";
> a2.y_location = "right";
> a2.tight_limits = "on";
> // plot of the second function
> plot(x,y2,"r");
> // set font size
> a1.font_size=3;
> a2.font_size=3;
> // delete tick marks of the first x axis
> a1.x_ticks=tlist(["ticks","locations","labels"],[],[])
> // add a grid
> a1.grid=[1,1];
> a2.grid=[1,1];
> // end of plotting
> // algorithm to equally scale the axes
> // minimum of the first function -> scalar
> y1min=min(y1);
> // maximum of the first function -> scalar
> y1max=max(y1);
> // minimum of the second function -> scalar
> y2min=min(y2);
> // maximum of the second function -> scalar
> y2max=max(y2);
> // divider for the first function -> scalar
> division1=find_division(y1min,y1max);
> // divider for the second function -> scalar
> division2=find_division(y2min,y2max);
> // lower axis left y axis the first function (normalized) -> scalar
> y1axismin=floor(y1min/division1)
> // upper axis left y axis the first function (normalized) -> scalar
> y1axismax=ceil(y1max/division1)
> // lower axis left y axis the second function (normalized) -> scalar
> y2axismin=floor(y2min/division2)
> // upper axis left y axis the second function (normalized) -> scalar
> y2axismax=ceil(y2max/division2)
> // distinction of cases
> if y1axismin*y1axismax>0 & y2axismin*y2axismax>0 then
> // both axes don't go over the value of zero
> // preset variable
> addupper=1;
> // start a loop, until both axes have the same number of dividers
> while y1axismax-y1axismin>y2axismax-y2axismin
> // left y axis has more dividers than the right y axis
> if addupper==1 & y2axismax~=-1
> // move the upper limit of the right y axis up
> y2axismax=y2axismax+1;
> end
> if addupper==-1 & y2axismin~=1
> // move the lower limit of the right y axis down
> y2axismin=y2axismin+1;
> end
> // toggle variable
> addupper=adduper*(-1);
> end
> // preset variable
> addupper=1;
> // start a loop, until both axes have the same number of dividers
> while y1axismax-y1axismin // left y axis hat weniger optimum rounded divider als right y
> axis
> if addupper==1 & y1axismax~=-1
> // move the upper limit of the left y axis up
> y1axismax=y1axismax+1;
> end
> if addupper==-1 & y1axismin~=1
> // move the lower limit of the left y axis down
> y1axismin=y1axismin+1;
> end
> // toggle variable
> addupper=adduper*(-1);
> end
> // rescale axes
> // lower limit of the left y axis
> a1.data_bounds(1,2)=y1axismin*division1;
> // lower limit of the left y axis
> a1.data_bounds(2,2)=y1axismax*division1;
> // lower limit of the left y axis
> a2.data_bounds(1,2)=y2axismin*division2;
> // lower limit of the left y axis
> a2.data_bounds(2,2)=y2axismax*division2;
> else
> // at least one of the axes goes over zero, or starts or ends at
> zero
> // find joint lower limit of both axes -> scalar
> ymin=min(y1axismin,y2axismin);
> // find joint upper limit of both axes -> scalar
> ymax=max(y1axismax,y2axismax);
> // rescale axes
> // lower limit of the left y axis
> a1.data_bounds(1,2)=ymin*division1;
> // lower limit of the left y axis
> a1.data_bounds(2,2)=ymax*division1;
> // lower limit of the left y axis
> a2.data_bounds(1,2)=ymin*division2;
> // lower limit of the left y axis
> a2.data_bounds(2,2)=ymax*division2;
> end
> endfunction
> 
> // Function to find a good division for the grid of a diagram
> // Input:
> //  axismin: minimum of the data to display -> scalar
> //  axismax: maximum of the data to display -> scalar
> // Output:
> //  division: optimum rounded divider to divide the axis into 5 to 10 parts
> function division=find_division(axismin

Re: [Scilab-users] 3D interpolation : comments adding

2017-03-25 Thread paul . carrico
Hi Tim 

That's indeed what I've read as well; my need remains to get a linear
interpolation between physical points ... I'm still digging in order to
find a "pleasant" code :_) 

Thanks for the feedback 

Paul 

Le 2017-03-25 17:52, t...@wescottdesign.com a écrit : 

> The help says that splin2d generates bicubic patches, so presumably
> it's not linear interpolation. 
> 
> On 2017-03-25 00:24, paul.carr...@free.fr wrote:
> 
>> Hi All
>> 
>> To go further in 2D/3D interpolation as I started in my previous
>> emails, I built the example here after.
>> 
>> As suggested, I had a look to
>> - cshep2d but but seems can not be used here (dimensions issue)
>> - splin2d + interp2d
>> 
>> In the later case, Am I right to say that splin2d "cross-sections"
>> the surface in order to define the "best spline" passing through the
>> nodes (in the cross section obviously), then the
>> interpolation/calculation is basically using this new 2D function,
>> right ?
>> 
>> if so this is not a linear interpolation between 2 nodes (as I
>> expect), isn't it?
>> 
>> Paul
>> 
>> 
>> 
>> mode(0)
>> 
>> n=10;
>> x = linspace(0,300,(n+1))';// abscissa
>> t = [0 25 100]; // temperature
>> z = 20*rand((n+1),3);// ordinate
>> // Nota : we must have the same number of data for both x and z
>> 
>> //  plot3d
>> clf()
>> a=get("current_axes");
>> a.x_label; x_label=a.x_label; x_label.text=" X abscissa";
>> a.y_label; y_label=a.y_label; y_label.text=" Temperature T";
>> a.z_label; z_label=a.z_label; z_label.text=" y ordinate";
>> plot3d(x,t,z)
>> 
>> // Nota: if I do a cross section normal to XoZ plane, I've the basic
>> curve z=f(x,T)) -> seems correct
>> 
>> //  interpolation
>> xp = [22 103 236]'
>> tp = [5 56 85]'
>> 
>> [Xp,Tp] = ndgrid(xp,tp)
>> 
>> ___
>> 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


[Scilab-users] 3D interpolation : comments adding

2017-03-25 Thread paul . carrico
Hi All

To go further in 2D/3D interpolation as I started in my previous emails,
I built the example here after. 

As suggested, I had a look to 
- cshep2d but but seems can not be used here (dimensions issue) 
- splin2d + interp2d 

In the later case, Am I right to say that splin2d "cross-sections" the
surface in order to define the "best spline" passing through the nodes
(in the cross section obviously), then the interpolation/calculation is
basically using this new 2D function, right ? 

if so this is not a linear interpolation between 2 nodes (as I expect),
isn't it? 

Paul 

 

mode(0)

n=10;
x = linspace(0,300,(n+1))';// abscissa
t = [0 25 100]; // temperature
z = 20*rand((n+1),3);// ordinate
// Nota : we must have the same number of data for both x and z

//  plot3d
clf()
a=get("current_axes");
a.x_label; x_label=a.x_label; x_label.text=" X abscissa";
a.y_label; y_label=a.y_label; y_label.text=" Temperature T";
a.z_label; z_label=a.z_label; z_label.text=" y ordinate";
plot3d(x,t,z)

// Nota: if I do a cross section normal to XoZ plane, I've the basic
curve z=f(x,T)) -> seems correct

//  interpolation
xp = [22 103 236]'
tp = [5 56 85]'

[Xp,Tp] = ndgrid(xp,tp)___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread paul . carrico
thanks all for the answers; I didn't know about ndgrid and I'm currently
having a look on it (seems to be quite interesting) 

Samuel: from your example and the help doc, I need to understand how to
proceed to perform linear interpolations (temperatures and abscissa's in
my example) 

Paul 

Le 2017-03-24 21:40, Samuel Gougeon a écrit : 

> Le 24/03/2017 à 18:40, paul.carr...@free.fr a écrit :
> 
>> Hi all,
>> 
>> I don't know if my question is relavante (or not), but I'm wondering
>> what is the best way to perform a 3D interpolation, from for the
>> matrix definition to the interpolation procedure.
>> 
>> Let me using a basic example: I've some curves y = f(x,T) defining a
>> material behaviour at different temperatures i.e. 1 curve (x,y) per
>> temperature:
>> - y = f(x,20)
>> - y = f(x,100)
>> - y = f(x,200)
>> 
>> etc.
>> 
>> What is the best way to define a single matrix? [x y T] ?
> 
> It depends on whether f() is vectorized or not. It could be something
> like
> t = [20 100 200];
> [X, T] = ndgrid(x, t);
> Y = f(X,T);
> // or
> Y = feval(x, t);
> 
> Then:
> M = [X(:) Y(:) T(:)];
> ___
> 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


[Scilab-users] 3D interpolation

2017-03-24 Thread paul . carrico
Hi all,

I don't know if my question is relavante (or not), but I'm wondering
what is the best way to perform a 3D interpolation, from for the matrix
definition to the interpolation procedure.

Let me using a basic example: I've some curves y = f(x,T) defining a
material behaviour at different temperatures i.e. 1 curve (x,y) per
temperature:
- y = f(x,20)
- y = f(x,100)
- y = f(x,200)

etc.

What is the best way to define a single matrix? [x y T] ?

Next step is to be able to perform a 3D interpolation whatever is the
temperature (for a given x) ... any advice? (of course I'm looking to
INTERP3D flag.

Thanks for any feedback

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


Re: [Scilab-users] non linear optim

2017-03-20 Thread paul . carrico

Hi All

I've ever been thinking that fminsearch uses Nelder-Mead algorthm i.e. 
it is an order 0 method (no gradient is needed to determine the local 
extremum) ; this is a personnal approach but I uses NeldeMead (with 
bounds and restarts) instead of fminsearch for a limited number of 
variables.


Nota bene : I'm still using Scilab 5.5.2 release

Paul



Le 2017-03-20 18:12, Tim Wescott a écrit :

On Mon, 2017-03-20 at 08:53 -0700, David Chèze wrote:

Hi Paul,

the leastsq examples run properly on my machine, as well as other
tests with
simple functions inside.

I looked at leastsq first because of the minimal request very simple
way to
express the problem f=costf(X) with functions that are not quickly
vectorizable. Otherwise I was used to datafit. I saw in lsqrsolve
that we
need to provide the numbers of equations to run the solver, maybe
it's
similar for leastsq ? In my case the costf function evaluates the
model over
7 tests, each test is 6 to 7 evaluations of different configurations.
I'm
limiting to 2 unknowns to calibrate in my model so the problem can be
solve
a priori  but leastsq is not informed of that a priori . 

and 




Hey David:

I think Paul is concerned that something broke in the transition from
5.x to 6.0.

I haven't used fminsearch, but it looks like it uses a significantly
different algorithm than leastsq and optim (I believe that optim uses
Newton's method, or perhaps a combination of Newton's method and
gradient descent).  So it could just be that the underlying algorithm
in fminsearch works better for your problem than the one for leastsq.

Looking at the relevant Wikipedia pages may suggest something:

https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method  (fminsearch)
https://en.wikipedia.org/wiki/Newton%27s_method_in_optimization (optim)

-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



___
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


[Scilab-users] (Graphical) Visualization of the structure workflow

2017-03-16 Thread paul . carrico

Hi All


When I need to re-used some codes/programs I performed, especially when 
the structure is "complex" (using several files and functions), I often 
need to spend some time to reappropriate it (even if ever I try to well 
comment my codes).


In order to be more efficient, I'm thinking in using graphic tools to 
writedown workflow, but I'm wondering if such tool ever exists in 
Scilab/atoms even (fully automatic or not)?


Nb: some name I found: Visual Understanding Envinronment, Graphviz ...

This post can be understand as a general discussion ...

Regards

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


Re: [Scilab-users] optim vs Neldermead: improvement

2017-01-23 Thread paul . carrico
Of course I did :-) 

It is a way as well to share feedback on the influence of some flags; as
it has been said 'it is my understanding" ... 

Paul 

Le 2017-01-23 11:37, Paul Bignier a écrit : 

> Hi Paul,
> 
> As I'm sure you've read them, optim [1 [1]], neldermead [2 [2]] &
> numderivative [3 [3]] help pages provide you with all the flags you can
> customize.
> After that, it's all in the functions that you provide to compute the
> cost & its derivative.
> 
> Best regards,
> Paul
> 
> On 01/23/2017 09:41 AM, paul.carr...@free.fr wrote:
> 
>> Hi All
>> 
>> I'm using 'optim' and 'NelderMead' in conjunction with my
>> finite element solver.
>> 
>> A "good" optimization is a balance between accuracy and cpu time
>> … in other word I do not necessary need to be accurate at 1e-11
>> but requiring a lot of iterations where 1e-3 is enough with a lower
>> amount of loops.
>> 
>> In my understanding:
>> 
>> * With 'optim', I can modifiy
>> 
>> * The step value h in numderivative (put at 1e-3 after previous
>> tests on analytical functions tests)
>> * The values of epsf (default value) and epsg (tested at 1e-3 and
>> 1e-5)
>> 
>> * With "Neldermead", I can change:
>> 
>> * Tolfunrelative (tested at default value for the moment)
>> * Tolxrelative (tested at default value for the moment)
>> 
>> Am I right or is there another 'flags' I can play with?
>> 
>> _NB_: so far, Nelder-Mead requires less iterations than 'optim'
>> with a single variable … I'm wondering how can I improve optim
>> use that is supposed to converge faster?
>> 
>> Thanks
>> 
>> Paul
>> 
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> 
> -- 
> Paul BIGNIER
> Development engineer
> ---
> Scilab Enterprises
> 143bis rue Yves Le Coz - 78000 Versailles, France
> Phone: +33.1.80.77.04.68
> http://www.scilab-enterprises.com
> 
> Links:
> --
> [1] https://help.scilab.org/docs/6.0.0/en_US/optim.html
> [2] https://help.scilab.org/docs/6.0.0/en_US/neldermead.html
> [3] https://help.scilab.org/docs/6.0.0/en_US/numderivative.html
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
 

Links:
--
[1] https://help.scilab.org/docs/6.0.0/en_US/optim.html
[2] https://help.scilab.org/docs/6.0.0/en_US/neldermead.html
[3] https://help.scilab.org/docs/6.0.0/en_US/numderivative.html___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] optim vs Neldermead: improvement

2017-01-23 Thread paul . carrico
Hi All 

I'm using 'optim' and 'NelderMead' in conjunction with my finite element
solver. 

A "good" optimization is a balance between accuracy and cpu time … in
other word I do not necessary need to be accurate at 1e-11 but requiring
a lot of iterations where 1e-3 is enough with a lower amount of loops. 

In my understanding: 

* With 'optim', I can modifiy

* The step value h in numderivative (put at 1e-3 after previous tests
on analytical functions tests)
* The values of epsf (default value) and epsg (tested at 1e-3 and
1e-5)

* With "Neldermead", I can change:

* Tolfunrelative (tested at default value for the moment)
* Tolxrelative (tested at default value for the moment)

 Am I right or is there another 'flags' I can play with? 

 _NB_: so far, Nelder-Mead requires less iterations than 'optim' with a
single variable … I'm wondering how can I improve optim use that is
supposed to converge faster? 

 Thanks 

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


Re: [Scilab-users] 'optim' vs 'Nelder-Mead' ... or difficulties to use 'optim'

2017-01-15 Thread paul . carrico
Hi Stephane, 

You're right, I forgot my basis :-) 

Nevertheless when I re-write the target function as the following, it
fails after some iterations and I do not understand the origin (??) 

Paul 

### 

function f=target(x)
val_lin = lineaire(x,1,2);
val_rac = racine(x,10,6);
//f = abs(val_lin - val_rac); 
f = sqrt((val_lin - val_rac)^2); 
printf("f = %g\n",f);
endfunction

## 
Console message: 
*** qnbd (with bound cstr) 
dimension= 1, epsq= 0.2220446049250313E-15, verbosity level: imp= 3
max number of iterations allowed: iter= 1000
max number of calls to costf allowed: nap= 1000

f = 23.6393
f = 25.1965
f = 22.0911
qnbd : iter= 1 f= 0.2363932D+02
qnbd : nbre fact 1 defact 0 total var factorisees 1
rlbd tp= 0.6440E+02 tmax= 0.1000E+11 dh0/dt=-0.6027E+00
f = 21.6468
f = 23.1924
f = 20.111
es t= 0.3318E+01 h=-0.1992E+01 dh/dt=-0.5981E+00 dfh/dt=-0.6005E+00 dt
0.3E+01
f = 4
f = 6.47214
f = 6
al_parameters,'qn','ar',nocf,niter,imp=3)
!--error 98 
La variable retournée par la fonction Scilab passée en argument n'est
pas valide.
at line 36 of exec file called by : 
RFACE/Rosembrock/fonctions_test.sce', -1

t= 0.6440E+02 h=-0.1992E+01 dh/dt=-0.5981E+00 dfh/dt= 0.E+00 dt
0.6E+02
qnbd : indqn= 0 

Le 2017-01-15 12:59, Stéphane Mottelet a écrit : 

> Hello 
> 
> Your target function is not differrentiable (Because of the absolute
> value). That explains why optim has some difficulties. Using a square
> instead should give the advantage to optim against nelder-mead.
> 
> S.
> 
>> Le 15 janv. 2017 à 11:39, paul.carr...@free.fr a écrit :
>> 
>> Hi all
>> 
>> Well, from a "macro" point of view, gradient based methods (order 1 method) 
>> should be more efficient than Nelder-Mead one (order 0) especially  for 1D 
>> topic, shouldn't be?
>> 
>> In the case here bellow, when I use 'Optim' it is not the case in comparison 
>> to 'NelderMead'... I don'y know what I'm doing wrong but I decide to frop 
>> off 'optim' in favor tp Nelder-Mead - nevertheless the later method requires 
>> much more iterations :-(
>> 
>> I'll be interested by some feedback on such topic, either in the mailing 
>> list (or in MP in order to not pollute it).
>> 
>> Paul
>> "
>> 'optim'
>> 
>> mode(0)
>> 
>> function f=lineaire(x, a2, b2)
>> f = a2*x+b2;
>> endfunction
>> 
>> function g=racine(x, a1, b1)
>> g = sqrt(a1*x) + b1;
>> endfunction
>> 
>> function f=target(x)
>> val_lin = lineaire(x,1,2);
>> val_rac = racine(x,10,6);
>> f = abs(val_lin - val_rac);
>> endfunction
>> 
>> // Cost function :
>> function [f, g, ind]=cost(x, ind)
>> f = target(x);
>> //g = numderivative(target, x.');
>> //g = numderivative(target, x.',0.1,order = 2);
>> g = numderivative(target, x.',order = 2);  // better but why ??? h automatic 
>> works better ???
>> //g = numderivative(target, x.',order = 4);
>> //g = numderivative(target, x.',0.1, order = 4);
>> endfunction
>> 
>> // optimisation avec optim
>> initial_parameters = [50]
>> lower_bounds = [0];
>> upper_bounds = [1000];
>> nocf = 1000;  // number of call of f
>> niter = 1000;// number of iterations
>> [fopt, xopt, gopt, work, iters, evals, err] = 
>> optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3);
>> xopt
>> fopt
>> err
>> 
>> // traçage courbes
>> x = linspace(0,50,1000)';
>> plot_raci = racine(x,10,6);
>> plot_lin = lineaire(x,1,2);
>> 
>> scf(1);
>> drawlater();
>> xgrid(3);
>> f = gcf();
>> //f
>> f.figure_size = [1000, 1000];
>> f.background = color(255,255,255);
>> a = gca();
>> //a
>> a.font_size = 2;
>> a.x_label.text = "X axis" ;
>> a.x_location="bottom";
>> a.x_label.font_angle=0;
>> a.x_label.font_size = 4;
>> a.y_label.text = "Y axis";
>> a.y_location="left";
>> a.y_label.font_angle=-90;
>> a.Y_label.font_size = 4;
>> a.title.text = "Title";
>> a.title.font_size = 5;
>> a.line_style = 1;
>> 
>> // début des courbes
>> plot(x,plot_lin);
>> e1 = gce();
>> p1 = e1.children;
>> p1.thickness = 1;
>> p1.line_style = 1;
>> p1.foreground = 3;
>> 
>> plot(x,plot_raci);
>> e2 = gce();
>> p2 = e2.children;
>> p2.thickness = 1;
>> p2.line_style = 1;
>> p2.foreground = 2;
>> drawnow();
>> 
>> ###
>> Nelder Mead
>> ###
>> mode(0)
>> 
>> function f=lineaire(x, a2, b2)
>> f = a2*x+b2;
>> endfunction
>> 
>> function g=racine(x, a1, b1)
>> g = sqrt(a1*x) + b1;
>> endfunction
>> 
>> function [f, index]=target(x, index)
>> val_lin = lineaire(x,1,2);
>> val_rac = racine(x,10,6);
>> f = abs(val_lin - val_rac);
>> endfunction
>> 
>> // optimisation avec optim
>> initial_parameters = [50]
>> lower_bounds = [0];
>> upper_bounds = [1000];
>> 
>> nm = neldermead_new ();
>> nm = neldermead_configure(nm,"-numberofvariables",1);
>> nm = nelderm

[Scilab-users] 'optim' vs 'Nelder-Mead' ... or difficulties to use 'optim'

2017-01-15 Thread paul . carrico
Hi all

Well, from a "macro" point of view, gradient based methods (order 1
method) should be more efficient than Nelder-Mead one (order 0)
especially  for 1D topic, shouldn't be?

In the case here bellow, when I use 'Optim' it is not the case in
comparison to 'NelderMead'... I don'y know what I'm doing wrong but I
decide to frop off 'optim' in favor tp Nelder-Mead - nevertheless the
later method requires much more iterations :-(

I'll be interested by some feedback on such topic, either in the mailing
list (or in MP in order to not pollute it).

Paul

" 
'optim' 
 

mode(0)

function f=lineaire(x, a2, b2)
f = a2*x+b2;
endfunction

function g=racine(x, a1, b1)
g = sqrt(a1*x) + b1;
endfunction

function f=target(x)
val_lin = lineaire(x,1,2);
val_rac = racine(x,10,6);
f = abs(val_lin - val_rac);
endfunction

// Cost function : 
function [f, g, ind]=cost(x, ind)
f = target(x);   
//g = numderivative(target, x.'); 
//g = numderivative(target, x.',0.1,order = 2); 
g = numderivative(target, x.',order = 2);  // better but why ??? h
automatic works better ???
//g = numderivative(target, x.',order = 4); 
//g = numderivative(target, x.',0.1, order = 4);
endfunction

// optimisation avec optim
initial_parameters = [50]
lower_bounds = [0];
upper_bounds = [1000];
nocf = 1000;  // number of call of f
niter = 1000;// number of iterations
[fopt, xopt, gopt, work, iters, evals, err] =
optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3);
xopt
fopt
err

// traçage courbes
x = linspace(0,50,1000)';
plot_raci = racine(x,10,6);
plot_lin = lineaire(x,1,2);

scf(1);
drawlater();
xgrid(3);
f = gcf(); 
//f  
f.figure_size = [1000, 1000];
f.background = color(255,255,255);   
a = gca();   
//a  
a.font_size = 2; 
a.x_label.text = "X axis" ;  
a.x_location="bottom";   
a.x_label.font_angle=0;  
a.x_label.font_size = 4; 
a.y_label.text = "Y axis";
a.y_location="left";
a.y_label.font_angle=-90;
a.Y_label.font_size = 4;
a.title.text = "Title"; 
a.title.font_size = 5;
a.line_style = 1;

// début des courbes
plot(x,plot_lin);
e1 = gce(); 
p1 = e1.children;   
p1.thickness = 1;
p1.line_style = 1;
p1.foreground = 3;

plot(x,plot_raci);
e2 = gce(); 
p2 = e2.children;   
p2.thickness = 1;
p2.line_style = 1;
p2.foreground = 2;
drawnow();

###
Nelder Mead
###

mode(0)

function f=lineaire(x, a2, b2)
f = a2*x+b2;
endfunction

function g=racine(x, a1, b1)
g = sqrt(a1*x) + b1;
endfunction

function [f, index]=target(x, index)
val_lin = lineaire(x,1,2);
val_rac = racine(x,10,6);
f = abs(val_lin - val_rac);
endfunction

// optimisation avec optim
initial_parameters = [50]
lower_bounds = [0];
upper_bounds = [1000];

nm = neldermead_new ();
nm = neldermead_configure(nm,"-numberofvariables",1);
nm = neldermead_configure(nm,"-function",target);
nm = neldermead_configure(nm,"-x0",initial_parameters);
nm = neldermead_configure(nm,"-maxiter",1000); 
nm = neldermead_configure(nm,"-maxfunevals",1000); 
nm = neldermead_configure(nm,"-tolfunrelative",10*%eps);
nm = neldermead_configure(nm,"-tolxrelative",10*%eps);
nm = neldermead_configure(nm,"-method","box");
nm = neldermead_configure(nm,"-boundsmin",lower_bounds);
nm = neldermead_configure(nm,"-boundsmax", upper_bounds);
nm = neldermead_search(nm);
nm = neldermead_restart(nm);
xopt = neldermead_get(nm,"-xopt")
fopt = neldermead_get(nm,"-fopt")
nm = neldermead_destroy(nm);

// traçage courbes
x = linspace(0,50,1000)';
a1 = 10; b1 = 6;  // b1 > b2 here
a2 = 1; b2 = 2;

plot_raci = racine(x,a1,b1);
plot_lin = lineaire(x,a2,b2);

scf(1);
drawlater();
xgrid(3);
f = gcf(); 
//f  
f.figure_size = [1000, 1000];
f.background = color(255,255,255);   
a = gca();   
//a  
a.font_size = 2; 
a.x_label.text = "X axis" ;  
a.x_location="bottom";   
a.x_label.font_angle=0;  
a.x_label.font_size = 4; 
a.y_label.text = "Y axis";
a.y_location="left";
a.y_label.font_angle=-90;
a.Y_label.font_size = 4;
a.title.text = "Title"; 
a.title.font_size = 5;
a.line_style = 1;

// début des courbes
plot(x,plot_lin);
e1 = gce(); 
p1 = e1.children;   
p1.thickness = 1;
p1.line_style = 1;
p1.foreground = 3;

plot(x,plot_raci);
e2 = gce(); 
p2 = e2.chil

Re: [Scilab-users] Optim use and 'err' flag

2017-01-14 Thread paul . carrico
Hi Paul 

I found why I had err=3: I was "playing" with the step value of
numderivative and I sent the last trial; neveryheless if you remove it
of use a low value such as 0.01 instead of 0.1, the err value becomes 3 

CQFD :-) 

Paul 

Le 2017-01-13 22:15, paul.carr...@free.fr a écrit : 

> Hi Paul 
> 
> I've been using the latest Scilab stable release on my working
> station; nevertheless you're right I get 12 when running the code on
> my laptop (same release but under Linux). 
> 
> Paul 
> 
> Le 2017-01-13 17:11, Paul Bignier a écrit : 
> 
> Hello Paul,
> 
> Running your script gives me "err=12", which is not documented but I
> don't get how you got 3?
> 
> I see though that you reached 'evals' & 'iters', perhaps optim
> wanted
> to continue but was capped by those.
> 
> Feel free to use the format [1 [1]] function to get more on-screen
> precision to your values.
> 
> I will surely commit something soon in order to fix the "12" flag.
> 
> Have a good evening,
> 
> Paul
> 
> On 01/13/2017 02:39 PM, paul.carr...@free.fr wrote:
> 
> Hi all
> 
> I'm trying to improve how to use Optim in Scilab, so I'm still
> using the basic Rosembrock function; in the example hereafter, one
> can see that Optim goes back the Error flag to 3 and I do not
> understand why?
> 
> The goal is to be able to check all the values of this flag in
> order
> to validate the result ; while the values are the optimized ones,
> the calculation indicates that the optimization fails …
> 
> I'm a bit loss … so any feedback will be appreciated
> 
> Thanks
> 
> Paul

###


>> In my understanding:
>> -err = 9 : everything went well … ok
>> 
>> -err = 3 : Optimization stops because of too small variations
>> for x
>> -err=1 : Norm of projected gradient lower than …
>> -err=2 : At last iteration f decreases by less than …
>> -err=4 : Optim stops: maximum number of calls to f is reached
>> ==> increase nocf
>> -err=5 : Optim stops: maximum number of iterations is reached.
>> ==> increase niter
>> -err=6 : Optim stops: too small variations in gradient
>> direction.
>> -err=7 : Stop during calculation of descent direction.
>> -err=8 : Stop during calculation of estimated hessian.
>> -err=10 : End of optimization (linear search fails).
>> 
>> // Rosembrock function
>> function f=rosembrock(x)
>> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;
>> endfunction
>> 
>> // Cost function
>> function [f, g, ind]=cost(x, ind)
>> f = rosembrock(x);
>> //g = derivative(rosembrock, x.',order = 4);
>> //g = numderivative(rosembrock, x.',order = 4);
>> g = numderivative(rosembrock, x.',0.1, order = 4);
>> endfunction
>> 
>> initial_parameters = [10 100]
>> lower_bounds = [0 0];
>> upper_bounds = [1000 1000];
>> nocf = 10;  // number of call of f
>> niter = 10;// number of iterations
>> [fopt, xopt, gopt, work, iters, evals, err] =

optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter);


>> xopt
>> fopt
>> iters
>> evals
>> err
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> 
> --
> Paul BIGNIER
> Development engineer
> ---
> Scilab Enterprises
> 143bis rue Yves Le Coz - 78000 Versailles, France
> Phone: +33.1.80.77.04.68
> http://www.scilab-enterprises.com
> 
> Links:
> --
> [1] https://help.scilab.org/docs/6.0.0/en_US/format.html
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

Links:
--
[1] https://help.scilab.org/docs/6.0.0/en_US/format.html
___
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] Optim use and 'err' flag

2017-01-13 Thread paul . carrico
Paul, 

When using imp=3, I can see that 'iters' returns in fact the value of
niter (ditto for evals and nocf): am I right ? 

[fopt, xopt, gopt, work, iters, evals, err] =
optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3);

(thanks for the support) 

Paul 

Le 2017-01-13 18:06, Paul Bignier a écrit : 

> To complete my previous answer, the error arose from the built-in line
> search algorithm (err>10 means different flavors of it failing). In
> your case, it is pointing to a "too small deltaT", so yes it looks
> like your algorithm is converging but it has trouble finishing. 
> 
> You can get more info by using "imp=3" in your call to optim (as
> documented). If you are using a nightly build then use "iprint=3" (the
> online doc hasn't been updated yet). 
> 
> Best regards, 
> 
> Paul 
> On 01/13/2017 05:11 PM, Paul Bignier wrote:
> 
> Hello Paul,
> 
> Running your script gives me "err=12", which is not documented but I
> don't get how you got 3?
> 
> I see though that you reached 'evals' & 'iters', perhaps optim
> wanted to continue but was capped by those.
> 
> Feel free to use the format [1 [1]] function to get more on-screen
> precision to your values.
> 
> I will surely commit something soon in order to fix the "12" flag.
> 
> Have a good evening,
> 
> Paul
> 
> On 01/13/2017 02:39 PM, paul.carr...@free.fr wrote:
> 
> Hi all
> 
> I'm trying to improve how to use Optim in Scilab, so I'm still
> using the basic Rosembrock function; in the example hereafter, one
> can see that Optim goes back the Error flag to 3 and I do not
> understand why?
> 
> The goal is to be able to check all the values of this flag in
> order to validate the result ; while the values are the optimized
> ones, the calculation indicates that the optimization fails …
> 
> I'm a bit loss … so any feedback will be appreciated
> 
> Thanks
> 
> Paul

###


>> In my understanding:
>> -err = 9 : everything went well … ok
>> 
>> -err = 3 : Optimization stops because of too small variations
>> for x
>> -err=1 : Norm of projected gradient lower than …
>> -err=2 : At last iteration f decreases by less than …
>> -err=4 : Optim stops: maximum number of calls to f is reached
>> ==> increase nocf
>> -err=5 : Optim stops: maximum number of iterations is reached.
>> ==> increase niter
>> -err=6 : Optim stops: too small variations in gradient
>> direction.
>> -err=7 : Stop during calculation of descent direction.
>> -err=8 : Stop during calculation of estimated hessian.
>> -err=10 : End of optimization (linear search fails).
>> 
>> // Rosembrock function
>> function f=rosembrock(x)
>> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;
>> endfunction
>> 
>> // Cost function
>> function [f, g, ind]=cost(x, ind)
>> f = rosembrock(x);
>> //g = derivative(rosembrock, x.',order = 4);
>> //g = numderivative(rosembrock, x.',order = 4);
>> g = numderivative(rosembrock, x.',0.1, order = 4);
>> endfunction
>> 
>> initial_parameters = [10 100]
>> lower_bounds = [0 0];
>> upper_bounds = [1000 1000];
>> nocf = 10;  // number of call of f
>> niter = 10;// number of iterations
>> [fopt, xopt, gopt, work, iters, evals, err] =

optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter);


>> xopt
>> fopt
>> iters
>> evals
>> err
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> 
> --
> Paul BIGNIER
> Development engineer
> ---
> Scilab Enterprises
> 143bis rue Yves Le Coz - 78000 Versailles, France
> Phone: +33.1.80.77.04.68
> http://www.scilab-enterprises.com
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Paul BIGNIER
Development engineer
---
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
http://www.scilab-enterprises.com

Links:
--
[1] https://help.scilab.org/docs/6.0.0/en_US/format.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users 

Links:
--
[1] https://help.scilab.org/docs/6.0.0/en_US/format.html___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Optim use and 'err' flag

2017-01-13 Thread paul . carrico
Hi Paul 

I've been using the latest Scilab stable release on my working station;
nevertheless you're right I get 12 when running the code on my laptop
(same release but under Linux). 

Paul 

Le 2017-01-13 17:11, Paul Bignier a écrit : 

> Hello Paul, 
> 
> Running your script gives me "err=12", which is not documented but I
> don't get how you got 3? 
> 
> I see though that you reached 'evals' & 'iters', perhaps optim wanted
> to continue but was capped by those. 
> 
> Feel free to use the format [1 [1]] function to get more on-screen
> precision to your values. 
> 
> I will surely commit something soon in order to fix the "12" flag. 
> 
> Have a good evening, 
> 
> Paul
> 
> On 01/13/2017 02:39 PM, paul.carr...@free.fr wrote:
> 
>> Hi all
>> 
>> I'm trying to improve how to use Optim in Scilab, so I'm still
>> using the basic Rosembrock function; in the example hereafter, one
>> can see that Optim goes back the Error flag to 3 and I do not
>> understand why?
>> 
>> The goal is to be able to check all the values of this flag in order
>> to validate the result ; while the values are the optimized ones,
>> the calculation indicates that the optimization fails …
>> 
>> I'm a bit loss … so any feedback will be appreciated
>> 
>> Thanks
>> 
>> Paul
> ###
>  
> 
>> In my understanding:
>> -err = 9 : everything went well … ok
>> 
>> -err = 3 : Optimization stops because of too small variations
>> for x
>> -err=1 : Norm of projected gradient lower than …
>> -err=2 : At last iteration f decreases by less than …
>> -err=4 : Optim stops: maximum number of calls to f is reached
>> ==> increase nocf
>> -err=5 : Optim stops: maximum number of iterations is reached.
>> ==> increase niter
>> -err=6 : Optim stops: too small variations in gradient
>> direction.
>> -err=7 : Stop during calculation of descent direction.
>> -err=8 : Stop during calculation of estimated hessian.
>> -err=10 : End of optimization (linear search fails).
>> 
>> // Rosembrock function
>> function f=rosembrock(x)
>> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;
>> endfunction
>> 
>> // Cost function
>> function [f, g, ind]=cost(x, ind)
>> f = rosembrock(x);
>> //g = derivative(rosembrock, x.',order = 4);
>> //g = numderivative(rosembrock, x.',order = 4);
>> g = numderivative(rosembrock, x.',0.1, order = 4);
>> endfunction
>> 
>> initial_parameters = [10 100]
>> lower_bounds = [0 0];
>> upper_bounds = [1000 1000];
>> nocf = 10;  // number of call of f
>> niter = 10;// number of iterations
>> [fopt, xopt, gopt, work, iters, evals, err] =
> optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter);
>  
> 
>> xopt
>> fopt
>> iters
>> evals
>> err
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> 
> -- 
> Paul BIGNIER
> Development engineer
> ---
> Scilab Enterprises
> 143bis rue Yves Le Coz - 78000 Versailles, France
> Phone: +33.1.80.77.04.68
> http://www.scilab-enterprises.com
> 
> Links:
> --
> [1] https://help.scilab.org/docs/6.0.0/en_US/format.html
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
 

Links:
--
[1] https://help.scilab.org/docs/6.0.0/en_US/format.html___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Optim use and 'err' flag

2017-01-13 Thread paul . carrico

Hi all

I’m trying to improve how to use Optim in Scilab, so I’m still using the 
basic Rosembrock function; in the example hereafter, one can see that 
Optim goes back the Error flag to 3 and I do not understand why?


The goal is to be able to check all the values of this flag in order to 
validate the result ; while the values are the optimized ones, the 
calculation indicates that the optimization fails …


I’m a bit loss … so any feedback will be appreciated

Thanks

Paul

###
In my understanding:
-   err = 9 : everything went well … ok

-   err = 3 : Optimization stops because of too small variations for x
-   err=1 : Norm of projected gradient lower than …
-   err=2 : At last iteration f decreases by less than …
-	err=4 : Optim stops: maximum number of calls to f is reached ==> 
increase nocf
-	err=5 : Optim stops: maximum number of iterations is reached. ==> 
increase niter

-   err=6 : Optim stops: too small variations in gradient direction.
-   err=7 : Stop during calculation of descent direction.
-   err=8 : Stop during calculation of estimated hessian.
-   err=10 : End of optimization (linear search fails).



// Rosembrock function
function f=rosembrock(x)
f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;
endfunction

// Cost function
function [f, g, ind]=cost(x, ind)
f = rosembrock(x);
//g = derivative(rosembrock, x.',order = 4);
//g = numderivative(rosembrock, x.',order = 4);
g = numderivative(rosembrock, x.',0.1, order = 4);
endfunction

initial_parameters = [10 100]
lower_bounds = [0 0];
upper_bounds = [1000 1000];
nocf = 10;  // number of call of f
niter = 10;// number of iterations
[fopt, xopt, gopt, work, iters, evals, err] = 
optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter);

xopt
fopt
iters
evals
err
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] derivative vs numderivative

2017-01-10 Thread paul . carrico
Hi all

I've not been using Scilab for optimization tasks for years and I
decided to dig up my old codes; I didn't follow such items in the
mailing list so the current questionning has probably ever been treated
(?!?!):

why numderivative leads to different result than derivative (since
derivative will be removed in the next release)? ... algorithms + step
calculation  are probably different (while they are using finite
difference method ... I don't know)

To myself first, I've made a (very) basic example based on the famous
Rosembrock function to perform tests 

Thanks for any support 

Paul

###"
mode(0)
clear

// function
function f = rosembrock(x)
f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;
endfunction

// cost function
function [f,g,ind] = cost(x,ind)
f = rosembrock(x);
//g = derivative(rosembrock, x.',order = 4); 
g = numderivative(rosembrock, x.',order = 4); 
endfunction

//initial_parameters = [10 10]
initial_parameters = [100 100]
//lower_bounds = [90 90];
lower_bounds = [0 0];
upper_bounds = [1000 1000];
//[fopt , xopt] = optim(cost,initial_parameters) 
[fopt , xopt] =
optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'ar',100,100)___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] find & vectorization

2016-12-28 Thread paul . carrico
Thanks for your help. 

Well I wanted to get the position of each scalar, as the loop does; I'll
be content to use a loop 

Thanks for your time. 

Paul 

Le 2016-12-28 14:43, Samuel Gougeon a écrit : 

> Le 28/12/2016 09:16, paul.carr...@free.fr a écrit :
> 
>> Hi all
>> 
>> I do not understand why the following code does not work when I try
>> to
>> use vectorization (many trials)?
>> 
>> What am I doing wrong ?
>> 
>> Thanks
>> 
>> Paul
>> 
>> 
>> mode(0)
>> 
>> A = [ 1 2 9 0 10 6 ; 5 3 8 8 0 9 ; 5 9 1 0 3 9]'
>> v = [2 9 6]'
>> 
>> index = zeros(3,1);
>> for i = 1 : 3
>> index(i) = find(A(:,1) == v(i));
>> end
>> disp(index)
>> 
>> i = [1 : 3]';
>> index2 = zeros(3,1); //pause
>> index2(i,1) = find(A(:,1) == v(i,1));
> 
> Actually, what you want and try to do is unclear. Even members() could
> be not appropriate.
> You can easily get an error even with your unvectorized version, as
> soon as one of the v components will appears several times in A(:,1)
> 
> SG
> ___
> 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


[Scilab-users] find & vectorization

2016-12-28 Thread paul . carrico
Hi all

I do not understand why the following code does not work when I try to
use vectorization (many trials)? 

What am I doing wrong ? 

Thanks 

Paul 
 

mode(0)

A = [ 1 2 9 0 10 6 ; 5 3 8 8 0 9 ; 5 9 1 0 3 9]'
v = [2 9 6]'

index = zeros(3,1);
for i = 1 : 3
index(i) = find(A(:,1) == v(i));
end
disp(index)

i = [1 : 3]';
index2 = zeros(3,1); //pause
index2(i,1) = find(A(:,1) == v(i,1));
disp(index2)___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Surface calculation

2016-12-26 Thread paul . carrico
Hi 

I finally found how to proceed in a simpler way ... 
http://paulbourke.net/geometry/polygonmesh/ 

Many interesting thinks on these pages 

Paul 

Le 2016-12-24 10:16, Rafael Guerra a écrit : 

> Hi Paul, 
> 
> Season's Greetings. 
> 
> Could you provide one representative example of your input mesh files?
> 
> Regards, 
> 
> Rafael 
> 
> FROM: users [mailto:users-boun...@lists.scilab.org] ON BEHALF OF
> paul.carr...@free.fr
> SENT: Saturday, December 24, 2016 9:54 AM
> TO: Users mailing list for Scilab 
> SUBJECT: Re: [Scilab-users] Surface calculation 
> 
> Hi 
> 
> The topic remains open (one never knows), but I think I found an
> interesting way to answer to my needs: the "ear clipping method"; then
> based on the triangles it becomes easy to calculate the surface. 
> 
> Paul 
> 
> Le 2016-12-23 23:42, paul.carr...@free.fr a écrit : 
> 
>> Hi All
>> 
>> I'm wondering how I can calculate (with accuracy) the value of any
>> closed surface composed of edges; these ones come from a mesh and
>> the
>> surface is no more than a hole.
>> 
>> In a first step I'm thinking in  Delaunay triangulation based on the
>> edges to mesh the surface (triangles), but maybe there are simpliest
>> ways (to avoid to reivent the wheel)? does somebody can advice?
>> 
>> Obviously the surface can be highly irregular, such as a daisy
>> flower
>> (to illustrate the shape).
>> 
>> Merry Christmas to all the community
>> 
>> Paul
> ___
> 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] Surface calculation

2016-12-24 Thread paul . carrico
Hi 

The topic remains open (one never knows), but I think I found an
interesting way to answer to my needs: the "ear clipping method"; then
based on the triangles it becomes easy to calculate the surface. 

Paul 

Le 2016-12-23 23:42, paul.carr...@free.fr a écrit : 

> Hi All
> 
> I'm wondering how I can calculate (with accuracy) the value of any
> closed surface composed of edges; these ones come from a mesh and the
> surface is no more than a hole.
> 
> In a first step I'm thinking in  Delaunay triangulation based on the
> edges to mesh the surface (triangles), but maybe there are simpliest
> ways (to avoid to reivent the wheel)? does somebody can advice?
> 
> Obviously the surface can be highly irregular, such as a daisy flower
> (to illustrate the shape).
> 
> Merry Christmas to all the community
> 
> Paul
> ___
> 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


[Scilab-users] Surface calculation

2016-12-23 Thread paul . carrico

Hi All

I'm wondering how I can calculate (with accuracy) the value of any 
closed surface composed of edges; these ones come from a mesh and the 
surface is no more than a hole.


In a first step I'm thinking in  Delaunay triangulation based on the 
edges to mesh the surface (triangles), but maybe there are simpliest 
ways (to avoid to reivent the wheel)? does somebody can advice?


Obviously the surface can be highly irregular, such as a daisy flower 
(to illustrate the shape).


Merry Christmas to all the community

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


Re: [Scilab-users] {EXT} Re: uicontrol & wiki

2016-12-22 Thread paul . carrico
blame you ... oh no :-) 

Good starting point, so thanks for your contrinution 

Paul 

Le 2016-12-22 09:21, Dang Ngoc Chan, Christophe a écrit : 

> Hello,
> 
> De : De la part de Samuel Gougeon
> Envoyé : mardi 20 décembre 2016 22:25
> 
> Le 20/12/2016 21:45, paul.carr...@free.fr a écrit :
> 
> (https://fr.wikibooks.org/wiki/Découvrir_Scilab/Créer_une_interface_graphique_GUI
>  - in French language). 
> In the callback, the instruction
> x = evstr(e.string);
> is not robust [...]
> For a robust implementation, gcbo.string is required instead.

I'm the one who committed this page so you can blame me (-:

The gcbo thing is explained a bit later in the page.
My aim is to introduce the notions one by one, step by step,
for a better understanding.

Nevertheless, if you think this method is not adapted to the topic,
feel free to propose modifications (or to do them by yourself).

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___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] uicontrol & wiki

2016-12-20 Thread paul . carrico
hi Samuel .. 

I think there's a misunderstanding in my questioning... I'm wondering
why this code works (under Scilab 5.5.2 at least) i.e. why I can plot
several points 

Paul 

Le 2016-12-20 22:10, Samuel Gougeon a écrit : 

> Hello Paul,
> 
> Le 20/12/2016 21:45, paul.carr...@free.fr a écrit :
> 
>> ###"
>> 
>> mode(0)
>> 
>> f = scf(0);
>> e = uicontrol(f, "style", "edit", ...
>> "position", [0 0 100 20]);
>> t = uicontrol(f, "style", "text", ...
>> "position", [200 0 100 20], ...
>> "string", "...");
>> b = uicontrol(f, "style", "pushbutton", ...
>> "string", "$x^2$",...
>> "position", [100 0 100 20], ...
>> "callback", "x = evstr(e.string);...
>> y = x^2;...
>> t.string = string(y);...
>> plot2d(x, y, style = -1);");
> I get
> --> b = uicontrol(f, "style", "pushbutton", ...
>> "string", "$x^2$",...
>> "position", [100 0 100 20], ...
>> "callback", "x = evstr(e.string);...
> "callback", "x = evstr(e.string);...
> ^^
> Error: Unexpected end of file in a string.
> 
> You can't break a string in this way, but with 
> "my string and "+..
> "my text"
> ___
> 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


[Scilab-users] uicontrol & wiki

2016-12-20 Thread paul . carrico
Hi

I've been looking to the wiki and an interesting article speaking about
GUI developments
(https://fr.wikibooks.org/wiki/Découvrir_Scilab/Créer_une_interface_graphique_GUI
- in French language). 

I've a naive question on the code hereafter: why is it possible to
implement several values? no loop is needed nor any breack condition ...
surprising but I do not understand :-) (naive question I confess) 

Thanks 

Paul 

ps: implement a value in the bottom left box and  click on the
pushbutton x^2

###"

mode(0)

f = scf(0);
e = uicontrol(f, "style", "edit", ...
"position", [0 0 100 20]);
t = uicontrol(f, "style", "text", ...
"position", [200 0 100 20], ...
"string", "...");
b = uicontrol(f, "style", "pushbutton", ...
"string", "$x^2$",...
"position", [100 0 100 20], ...
"callback", "x = evstr(e.string);...
y = x^2;...
t.string = string(y);...
plot2d(x, y, style = -1);");___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] How to remove all the figure in a single instruction

2016-12-05 Thread paul . carrico

thanks all - works fine

Paul

Le 2016-12-05 12:07, CRETE Denis a écrit :

Hello,
xdel(winsid())

HTH
Denis

[@@ THALES GROUP INTERNAL @@]

Unité Mixte de Physique CNRS / THALES
1 Avenue Augustin Fresnel
91767 Palaiseau CEDEx - France
Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
e-mail :
 denis.cr...@thalesgroup.com 
 http://www.trt.thalesgroup.com/ump-cnrs-thales
 http://www.research.thalesgroup.com


-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de
paul.carr...@free.fr
Envoyé : lundi 5 décembre 2016 12:06
À : users@lists.scilab.org
Objet : [Scilab-users] How to remove all the figure in a single 
instruction


Hi All

To remove all the figures in a single instruction, I'm using Xdel
keyword; for example, "xdel(1:10)" for the figure 1 to 10.

Nevertheless if I manually remove one of them in the meantime, it does
not work anymore.

Is there another way to proceed?


Nota bene: I tried something like "xdel(1:$)" but it does not work ->
would such way be interesting?

Paul
___
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


[Scilab-users] How to remove all the figure in a single instruction

2016-12-05 Thread paul . carrico

Hi All

To remove all the figures in a single instruction, I'm using Xdel 
keyword; for example, "xdel(1:10)" for the figure 1 to 10.


Nevertheless if I manually remove one of them in the meantime, it does 
not work anymore.


Is there another way to proceed?


Nota bene: I tried something like "xdel(1:$)" but it does not work -> 
would such way be interesting?


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


[Scilab-users] Re : Re: scilab and "parallelization" objectives

2016-10-22 Thread paul . carrico
The features has been tested on my laptop under ubuntu 16.04  LTS

Paul
- Mail d'origine -
De: Arvid Rosén 
À: Users mailing list for Scilab 
Envoyé: Sat, 22 Oct 2016 19:50:43 +0200 (CEST)
Objet: Re: [Scilab-users] scilab and "parallelization" objectives

What OS are you running? parallel_run does not work on macOS. It does work on 
Linux though.

Cheers,
Arvid

Get Outlook for iOS<https://aka.ms/o0ukef>


From: users  on behalf of Stéphane Mottelet 

Sent: Saturday, October 22, 2016 4:33:22 PM
To: Users mailing list for Scilab
Subject: Re: [Scilab-users] scilab and "parallelization" objectives

Hello,

As parallel_run is using child Scilab processes, the std output of all children 
is the terminal where you started Scilab and not the Scilab console.

S.

Le 22 oct. 2016 à 15:11, paul.carr...@free.fr<mailto:paul.carr...@free.fr> a 
écrit :

Thanks claus

I completely forgot this features (that I've ever tested but once only)

The first trial "works" if I focus only on the results, but as one can see on 
the screenshot, a part of the message appears in the console and the second one 
in the terminal (why ).

The code is the following one for my very basic exemple (I used 2 CPU's here 
because of my laptop features)

Paul

##

mode(0)

function status=test(i, t)
 printf("function %d is launched with a pause of %g second(s)n",i,t);
 sleep(t*1000);
 printf("function %d is endeednn",i);
 status = 0;
endfunction

// the duration is expressed in second(s)
//status = test(1,1);
//status = test(2,3);
//status = test(3,5);
//status = test(4,7);

number = [1 2]
duration = [1 3]
status = parallel_run(number,duration,"test")


Le 2016-10-22 10:26, Claus Futtrup a écrit :
Hi Paul

Have you/he/she looked into parallel_run() ?

Best regards,
Claus

On 22-10-2016 09:33, paul.carr...@free.fr<mailto:paul.carr...@free.fr> wrote:

Hi All

Maybe my previous email was unclear, but the example hereafter
summarizes what I would like to do :
- here function is launched when the previous is finished
("sequential way"),
- it is possible to launch them simultaneously?

_Nb_: I'm currently on Scilab 5.5.4 and maybe only the latest beta
release allows this ?

If I can do this, then "bingo"

Thanks

Paul
---

mode(0)

function status=test(i, t)
printf("function %d is launchedn",i);
sleep(t*1000);
printf("function %d is endeednn",i);
status = 0;
endfunction

// the duration is expressed in second(s)
status = test(1,1);
status = test(2,3);
status = test(3,5);
status = test(4,7);

-

DE: "Paul Carrico" 
mailto:paul.carr...@esterline.com>>
À: "International users mailing list for Scilab.
(users@lists.scilab.org<mailto:users@lists.scilab.org>)" 
mailto:users@lists.scilab.org>>
ENVOYÉ: Jeudi 20 Octobre 2016 15:41:18
OBJET: [Scilab-users] scilab and "parallelization" objectives

Dear All,

My internship had an interesting request and I’m not able to
answer to him JJ

The context is the following one:

- We are using a parallel finite element solver on 4
PROCESSORS (under Linux),

- We are performing optimization with an external
optimizer,

- Scilab has been interfaced with both the optimizer and
the solver,

- For the moment, the optimization loops are
“basically” performed using the parallelization capabilities of
the solvers.

In practice, Scilab “runs” the solver and “waits” the end of
the simulation (always using 4 processors) before calculating the
cost function value, giving the later value to the optimizer and
then closing.

IMAGINE THAT NOW we would like to run 4 DIFFERENT SIMULATIONS EACH
ON 1 PROCESSOR in order to determine the gain (CPU time) … how to
proceed ?

In practice Scilab must be able to :

- Launch 1rst calculation and to handback …

- … to launch the 2nd one … and so on

We can imagine creating a function per calculation (and I prefer in
order to mix stuffs), then running independently but at the same
time the different functions.

Honestly I’ve never done this before and I’m wondering how to
proceed … or if it is possible : any feedback on it ?

Thanks and regards

Paul

EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data

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

___
users mailing list
users@lists.scilab.org<mailto:users@lists.scilab.org>
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org<mai

Re: [Scilab-users] scilab and "parallelization" objectives

2016-10-22 Thread paul . carrico
Thanks claus 

I completely forgot this features (that I've ever tested but once only) 

The first trial "works" if I focus only on the results, but as one can
see on the screenshot, a part of the message appears in the console and
the second one in the terminal (why ). 

The code is the following one for my very basic exemple (I used 2 CPU's
here because of my laptop features) 

Paul 

##


mode(0)

function status=test(i, t)
printf("function %d is launched with a pause of %g
second(s)\n",i,t);
sleep(t*1000);
printf("function %d is endeed\n\n",i);
status = 0;
endfunction

// the duration is expressed in second(s)
//status = test(1,1);
//status = test(2,3);
//status = test(3,5);
//status = test(4,7);

number = [1 2]
duration = [1 3]
status = parallel_run(number,duration,"test")

Le 2016-10-22 10:26, Claus Futtrup a écrit : 

> Hi Paul
> 
> Have you/he/she looked into parallel_run() ?
> 
> Best regards,
> Claus
> 
> On 22-10-2016 09:33, paul.carr...@free.fr wrote:
> 
>> Hi All
>> 
>> Maybe my previous email was unclear, but the example hereafter
>> summarizes what I would like to do :
>> - here function is launched when the previous is finished
>> ("sequential way"),
>> - it is possible to launch them simultaneously?
>> 
>> _Nb_: I'm currently on Scilab 5.5.4 and maybe only the latest beta
>> release  allows this ?
>> 
>> If I can do this, then "bingo"
>> 
>> Thanks
>> 
>> Paul
>> ---
>> 
>> mode(0)
>> 
>> function status=test(i, t)
>> printf("function %d is launched\n",i);
>> sleep(t*1000);
>> printf("function %d is endeed\n\n",i);
>> status = 0;
>> endfunction
>> 
>> // the duration is expressed in second(s)
>> status = test(1,1);
>> status = test(2,3);
>> status = test(3,5);
>> status = test(4,7);
>> 
>> -
>> 
>> DE: "Paul Carrico" 
>> À: "International users mailing list for Scilab.
>> (users@lists.scilab.org)" 
>> ENVOYÉ: Jeudi 20 Octobre 2016 15:41:18
>> OBJET: [Scilab-users] scilab and "parallelization" objectives
>> 
>> Dear All,
>> 
>> My internship had an interesting request and I'm not able to
>> answer to him   JJ
>> 
>> The context is the following one:
>> 
>> -  We are using a parallel finite element solver on 4
>> PROCESSORS (under Linux),
>> 
>> -  We are performing optimization with an external
>> optimizer,
>> 
>> -  Scilab has been interfaced with both the optimizer and
>> the solver,
>> 
>> -  For the moment, the optimization loops are
>> "basically" performed using the parallelization capabilities of
>> the solvers.
>> 
>> In practice, Scilab "runs" the solver and "waits" the end of
>> the simulation (always using 4 processors) before calculating the
>> cost function value, giving the later value to the optimizer and
>> then closing.
>> 
>> IMAGINE THAT NOW we would like to run 4 DIFFERENT SIMULATIONS EACH
>> ON 1 PROCESSOR in order to determine the gain (CPU time) … how to
>> proceed ?
>> 
>> In practice Scilab must be able to :
>> 
>> -  Launch 1rst calculation and to handback …
>> 
>> -  … to launch the 2nd one … and so on
>> 
>> We can imagine creating a function per calculation (and I prefer in
>> order to mix stuffs), then running independently but at the same
>> time the different functions.
>> 
>> Honestly I've never done this before and I'm wondering how to
>> proceed … or if it is possible : any feedback on it ?
>> 
>> Thanks and regards
>> 
>> Paul
>> 
>> EXPORT CONTROL :
>> Cet email ne contient pas de données techniques
>> This email does not contain technical data
>> 
>> ___
>> 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___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] scilab and "parallelization" objectives

2016-10-22 Thread paul . carrico
Hi All 


Maybe my previous email was unclear, but the example hereafter summarizes what 
I would like to do : 
- here function is launched when the previous is finished ("sequential way"), 
- it is possible to launch them simultaneously? 


Nb : I'm currently on Scilab 5.5.4 and maybe only the latest beta release 
allows this ? 


If I can do this, then "bingo" 


Thanks 


Paul 
--- 
mode ( 0 ) function status = test ( i , t ) printf ( " function %d is 
launched\n " , i ) ; sleep ( t * 1000 ) ; printf ( " function %d is endeed\n\n 
" , i ) ; status = 0 ; endfunction // the duration is expressed in second(s) 
status = test ( 1 , 1 ) ; status = test ( 2 , 3 ) ; status = test ( 3 , 5 ) ; 
status = test ( 4 , 7 ) ; 
- Mail original -

De: "Paul Carrico"  
À: "International users mailing list for Scilab. (users@lists.scilab.org)" 
 
Envoyé: Jeudi 20 Octobre 2016 15:41:18 
Objet: [Scilab-users] scilab and "parallelization" objectives 



Dear All, 

My internship had an interesting request and I’m not able to answer to him JJ 

The context is the following one: 
- We are using a parallel finite element solver on 4 processors (under Linux), 
- We are performing optimization with an external optimizer, 
- Scilab has been interfaced with both the optimizer and the solver, 
- For the moment, the optimization loops are “basically” performed using the 
parallelization capabilities of the solvers. 

In practice, Scilab “runs” the solver and “waits” the end of the simulation 
(always using 4 processors) before calculating the cost function value, giving 
the later value to the optimizer and then closing. 

Imagine that now we would like to run 4 different simulations each on 1 
processor in order to determine the gain (CPU time) … how to proceed ? 

In practice Scilab must be able to : 
- Launch 1rst calculation and to handback … 
- … to launch the 2 nd one … and so on 

We can imagine creating a function per calculation (and I prefer in order to 
mix stuffs), then running independently but at the same time the different 
functions. 

Honestly I’ve never done this before and I’m wondering how to proceed … or if 
it is possible : any feedback on it ? 

Thanks and regards 

Paul 


EXPORT CONTROL : 
Cet email ne contient pas de données techniques 
This email does not contain technical data 

___ 
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 valleys [was: Forum dedicated to Scilab developments -> practical concern]

2016-10-07 Thread paul . carrico
Thanks Christophe for the "coup de main" (i.e for the help) 


I started to have a look on it in order to determine how I can use it in my 
project; the main goal remains to include such tool in optimization loops 
involving a fully "automatic" search (one path of reflexion among others) 


In a more general way, thanks to the community for the previous exchanges 


Paul 

- Mail original -

De: "Dang Ngoc Chan, Christophe"  
À: "Users mailing list for Scilab"  
Envoyé: Vendredi 7 Octobre 2016 10:50:18 
Objet: Re: [Scilab-users] Peaks and valleys [was: Forum dedicated to Scilab 
developments -> practical concern] 

Hello, 

> De : paul.carr...@free.fr 
> Envoyé : jeudi 6 octobre 2016 12:32 
> 
> thanks for the information and the link 

I updated the source code on the following page 
https://commons.wikimedia.org/wiki/File:Savitzky-golay_pic_gaussien_bruite.svg 
(vectorised, faster). 

Concerning the use of the Savitzky-Golay algorithm itself, 
once the algorithm is applied, something like 
band = (sign(Ysecond (1:$-1)).*sign(Ysecond (2:$))==1) 
will give you where the second derivative sign changes, 
i.e. the bands where a peak or a valley lie, 
and find(band) will give you the indices. 

Then, you can search the min or the max in each band (on the smoothed data) 
which should give you the position of the peaks and valeys. 

I suggest to test several width of the window for each set of data 
(the degree of the polynomial should always be 3 IMHO) 
too let your brain finally decide what is a peak/valley and what is not. 

HTH 

-- 
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 

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


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread paul . carrico
thanks everybody for the supports 


Paul 

- Mail original -

De: "Mike Page"  
À: "Users mailing list for Scilab"  
Envoyé: Jeudi 6 Octobre 2016 12:34:59 
Objet: Re: [Scilab-users] Scilab control after an impossible calculation 







Hi Paul, 

Would Scilab's try-catch block do what you want? For example: 

for i=1:10; 
try; 
disp(1/(i-5)); 
catch; 
disp("err"); 
end; 
end 

won't crash when it gets to the divide by zero. 

This is the more structured way, but you can use execstr with errcatch to do 
the same thing. 

HTH 
Mike. 




On 6 October 2016 at 09:51, < paul.carr...@free.fr > wrote: 





Hi All 

I’m using Scilab as the interface between my optimizer and my finite element 
solver(s) and sometimes Scilab stops because of unexpected and impossible 
calculus (1/x with x = 0 as an example ); obviously Scilab stops (and so the 
optimization). 

I’m wondering if it’s possible: 
- To ask back Scilab a message such as “hey I crashed because you’re a fool and 
you’ve not anticipated an impossible calculation !!!” 
- To get back Scilab control in order to avoid optimization process crash ? 
I’ve been thinking in affecting a cost function value at %inf for example (not 
elegant I recognize) 

I don’t know if I’m understandable enough … 

Paul 
___ 
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 valleys [was: Forum dedicated to Scilab developments -> practical concern]

2016-10-06 Thread paul . carrico
thanks for the information and the link 


Paul 

- Mail original -

De: "Dang Ngoc Chan, Christophe"  
À: "Users mailing list for Scilab"  
Envoyé: Jeudi 6 Octobre 2016 10:26:50 
Objet: [Scilab-users] Peaks and valleys [was: Forum dedicated to Scilab 
developments -> practical concern] 

Hello, 

> De : paul.carr...@free.fr 
> Envoyé : mercredi 5 octobre 2016 21:56 
> 
> In attachment is typically a project I'm working on : 
> determination of peaks and valley on a noisy signal; 
> Trying to avoid reinventing the wheel, 
> I had a look on information's and algorithms on internet  
> not so easy topics I was thinking at the first time. 

I used to work in the X-ray diffraction and fluorescence field, 
where the detection of peaks is a main concern. 
All this depends on the signal-to-noise ratio, but we used the following 
algorithms, 
Applied one after the other: 

— cutting the signal that is below the background noise: 
in the X-ray field, the noise follows a Poisson statistics, 
so if you know the background level (determined "manually"), 
you can eliminate bands where the signal is below bkg + 3*sigma 

— Savitzky-Golay algorithm for smoothing and determining the first and second 
derivative: 
the peak summit is a local minimum of the 2nd derivative, 
and the inflection points (i.e. its zeroes) can be used to estimate the peak 
width and also possibly its location 
(chord middle) 
https://commons.wikimedia.org/wiki/File:Savitzky-golay_pic_gaussien_bruite.svg 

— eliminating the parasites: 
in this field, the peaks have a minimum width, 
so you can remove any detected peak if the first derivative is unexpectedly 
high. 

We also used "de-summation", 
i.e. from a set of peak position 
(determined automatically or manually), 
we generate a curve as a sum of "perfect peaks" 
(Gaussian, Lorentzian, pseudo-Voigt, Pearson-VII etc.) 
and we adjust the peaks parameters (position, width, shape) 
to minimise the quadratic difference with the signal 
(i.e. non-linear regression). 

I don't know if this is useful in your field, 
but the Savitzky-Golay algorithm is something widely used 
and easy to implement (especially if the points are uniformly spaced in x) 
and if the peak position and width have a physical meaning, 
de-summation can be powerful. 

-- 
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 

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


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread paul . carrico

thanks for the advice 

well I tried but it does not work as expected ; errcatch seems to be obsolete 
so I'm testing it with execstr: the warning is not displayed ... why  


### 

mode(0) 


try 
x = 0; 
y = (1/x) 


if execstr(('y','errcatch') <> 0) then 
printf("you''re a fool\n"); 
else 
printf("Everything is going well\n"); 
end 
errclear; 
end 
- Mail original -

De: "Jens Simon Strom"  
À: "Users mailing list for Scilab"  
Envoyé: Jeudi 6 Octobre 2016 11:48:50 
Objet: Re: [Scilab-users] Scilab control after an impossible calculation 

Try errcatch (). 

 

Am 06.10.2016 10:51, schrieb paul.carr...@free.fr : 




Hi All 

I’m using Scilab as the interface between my optimizer and my finite element 
solver(s) and sometimes Scilab stops because of unexpected and impossible 
calculus (1/x with x = 0 as an example ); obviously Scilab stops (and so the 
optimization). 

I’m wondering if it’s possible: 
- To ask back Scilab a message such as “hey I crashed because you’re a fool and 
you’ve not anticipated an impossible calculation !!!” 
- To get back Scilab control in order to avoid optimization process crash ? 
I’ve been thinking in affecting a cost function value at %inf for example (not 
elegant I recognize) 

I don’t know if I’m understandable enough … 

Paul 

___
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


[Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread paul . carrico

Hi All 

I’m using Scilab as the interface between my optimizer and my finite element 
solver(s) and sometimes Scilab stops because of unexpected and impossible 
calculus (1/x with x = 0 as an example ); obviously Scilab stops (and so the 
optimization). 

I’m wondering if it’s possible: 
- To ask back Scilab a message such as “hey I crashed because you’re a fool and 
you’ve not anticipated an impossible calculation !!!” 
- To get back Scilab control in order to avoid optimization process crash ? 
I’ve been thinking in affecting a cost function value at %inf for example (not 
elegant I recognize) 

I don’t know if I’m understandable enough … 

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


Re: [Scilab-users] Forum dedicated to Scilab developments -> practical concern

2016-10-05 Thread paul . carrico
Hi 

In attachment is typically a project I'm working on : determination of peaks 
and valley on a noisy signal; Trying to avoid reinventing the wheel, I had a 
look on information's and algorithms on internet  not so easy topics I was 
thinking at the first time. 


Typically a project that can federate people around ... an example among others 



Nb : the "peaks detector" project is non applicable on noisy signals (while 
vectorization is quit interresting) 


Paul 


- Mail original -

De: "paul carrico"  
À: "Users mailing list for Scilab"  
Envoyé: Mardi 4 Octobre 2016 22:07:29 
Objet: Re: [Scilab-users] Forum dedicated to Scilab developments 



Well I'm speaking about projects using Scilab (and then related to it), but not 
directly how to use it. 


For example, we can find forums dedicated to Electronics, Signal processing, 
Mechanical engineering, Optimization, Arduino and so on, in different places 
and not necessary using a common tool such as Scilab. 


Based on my own experience, I've ever asked advices on fields that are not in 
my skills , and I've had friendly supports. 


Now I've been wondering if it wouldn't be interesting to have one centralizing 
exchanges  but maybe I'm too naive 


it does not matter 


Paul 


- Mail original -

De: "Samuel Gougeon"  
À: "Users mailing list for Scilab"  
Envoyé: Mardi 4 Octobre 2016 21:38:05 
Objet: Re: [Scilab-users] Forum dedicated to Scilab developments 


Hello, 

Le 04/10/2016 19:31, paul.carr...@free.fr a écrit : 



Hi 

Recently somebody reminded me that the current mailing list is dedicated to 
Scilab topics (on only to) i.e. on ways on using Scilab. 

Does it exist a forum dedicated to developments using Scilab, so that people 
can share skills or ask for support(s) in specific topics/tasks? 

. 
Isn't it what we do here? 
See also http://mailinglists.scilab.org/ 




In my mind a way to share codes and so on! 


We may do it here as well, 
and there: https://fileexchange.scilab.org/ 

Samuel Gougeon 


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




peak_valley_search.sce
Description: Binary data
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Forum dedicated to Scilab developments

2016-10-04 Thread paul . carrico

Well I'm speaking about projects using Scilab (and then related to it), but not 
directly how to use it. 


For example, we can find forums dedicated to Electronics, Signal processing, 
Mechanical engineering, Optimization, Arduino and so on, in different places 
and not necessary using a common tool such as Scilab. 


Based on my own experience, I've ever asked advices on fields that are not in 
my skills , and I've had friendly supports. 


Now I've been wondering if it wouldn't be interesting to have one centralizing 
exchanges  but maybe I'm too naive 


it does not matter 


Paul 


- Mail original -

De: "Samuel Gougeon"  
À: "Users mailing list for Scilab"  
Envoyé: Mardi 4 Octobre 2016 21:38:05 
Objet: Re: [Scilab-users] Forum dedicated to Scilab developments 


Hello, 

Le 04/10/2016 19:31, paul.carr...@free.fr a écrit : 



Hi 

Recently somebody reminded me that the current mailing list is dedicated to 
Scilab topics (on only to) i.e. on ways on using Scilab. 

Does it exist a forum dedicated to developments using Scilab, so that people 
can share skills or ask for support(s) in specific topics/tasks? 

. 
Isn't it what we do here? 
See also http://mailinglists.scilab.org/ 




In my mind a way to share codes and so on! 


We may do it here as well, 
and there: https://fileexchange.scilab.org/ 

Samuel Gougeon 


___ 
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


[Scilab-users] Forum dedicated to Scilab developments

2016-10-04 Thread paul . carrico
Hi 

Recently somebody reminded me that the current mailing list is dedicated to 
Scilab topics (on only to) i.e. on ways on using Scilab. 

Does it exist a forum dedicated to developments using Scilab, so that people 
can share skills or ask for support(s) in specific topics/tasks? In my mind a 
way to share codes and so on! 

Nb : Equalis forum is nearly dead, developper.com is for French speakers ... 

I've been hesitating in writting this post, but I'm thinking it might be an 
interesting questionning ... if not it does not matter 

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


Re: [Scilab-users] shift phase in fft

2016-09-29 Thread paul . carrico

Thanks Rafael (and Antoine as well) 

Now I think I understand what went wrong 

Paul 
- Mail original -

De: "Rafael Guerra"  
À: "Users mailing list for Scilab"  
Envoyé: Jeudi 29 Septembre 2016 13:38:09 
Objet: Re: [Scilab-users] shift phase in fft 



Hi Paul, 

Your phase rotation seems to be working fine but the fft output is complex and 
only the real part is plotted by Scilab and that is why the resulting amplitude 
seems to be smaller. 

If you want to have your output real, one way is may be to handle separately 
the positive and negative frequencies as follows: 
clf () ; f = 10 ; // frequency omega = 2 * %pi * f; // circular frequency nb_T 
= 5 ; // number of periods t1 = 0 ; t2 = ( nb_T / f ) ; n = 10 ; t = linspace ( 
t1,t2, 2 ^ n ) ' ; // must be a power of 2 nl = size ( t, "*" ) ; s1 = 2 * sin 
( omega * t ) ; // original signal plot ( t,s1, "r" ) ; phi = %pi / 3 ; s2 = 2 
* sin ( omega * t + phi ) ; // targetted signal to be rebuilt plot ( t,s2, "b" 
) ; // shift phase in the fft s1_fft = fft ( s1 ) ; s1_fft ( 1 : nl / 2 ) = 
s1_fft ( 1 : nl / 2 ) .* exp ( % i * phi ) ; s1_fft ( nl / 2 :$ ) = s1_fft ( nl 
/ 2 :$ ) .* exp ( - % i * phi ) ; s1_new = ifft ( s1_fft ) ; plot ( t,s1_new, 
"--g" ) ; 


Regards, 
Rafael 





___ 
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


[Scilab-users] shift phase in fft

2016-09-29 Thread paul . carrico
Dear all 


I'm sorry about asking a so basic question, but I do not understand how to make 
a shift phase in a fft ; There's something I do not catch what ? 


Regards 


Paul 




## 

mode(0) 
clear all 


f = 10; // frequency 
omega = 2*%pi*f; // circular frequency 
nb_T = 5; // number of periods 
t1 = 0; 
t2 = (nb_T / f); 
n = 10; 
t = linspace(t1,t2,2^n)'; // must be a power of 2 
nl = size(t,"*"); 


s1 = 2*sin(omega*t); // original signal 
plot(t,s1,"r"); 


phi = %pi/3; 
s2 = 2*sin(omega*t + phi); // targetted signal to be rebuilt 
plot(t,s2,"b"); 


// shift phase in the fft 
s1_fft = fft(s1); 
s1_fft = clean(s1_fft); 

//s1_fft = s1_fft. * exp(-%i*phi/nl); 
s1_fft = s1_fft. * exp(-%i*phi); 
s1_new = ifft(s1_fft); 
plot(t,s1_new,"g"); 


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


[Scilab-users] scilab 6 and vectorization

2016-09-27 Thread paul . carrico
Hi

I cannot say if this topic has ever been discussed so far, but I installed 
Scilab 6.0 in order to work with a huge amount of data ; unlike the current 
stable data that is limited to 2 Go, the 6.0 one is announced to not be limited 
...
... I tried a code using vectorization and I've been disappointed to notice 
that it doesn't work

Is there a document summarizing the changes regarding this topic?

Regards

Paul

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


Re: [Scilab-users] issue with "sum"

2016-09-27 Thread paul . carrico
"remember"  heuhhh ... :-)

Thanks Stephane

- Mail original -
De: "Stéphane Mottelet" 
À: "Users mailing list for Scilab" 
Envoyé: Mardi 27 Septembre 2016 15:09:36
Objet: Re: [Scilab-users] issue with "sum"

paul,

remember the transpose is *conjugate transpose*, use .' instead.

S.

Le 27/09/2016 à 15:04, paul.carr...@free.fr a écrit :
> Hi again
>
> In the following example, the sum lead to an opposite sign for the complex 
> part … Am I doing something wrong ?
>
> thanks for any highlight
>
> Paul
>
> 
> mode(0)
>
> A = [
> - 3.
> 6.123D-17
> 3.
> - 3.
> - 3.062D-17 - 5.303D-17*%i
> - 1.5 + 2.5980762*%i
> - 3.
> - 3.062D-17 + 5.303D-17*%i
>   - 1.5 - 2.5980762*%i]
>
> mat = matrix(A,3,3)
>
> sum1 = sum(mat,'r')' // reference matrix
>
> sum_c1 = sum(mat(:,1)) // sum of the 1rst column of sum1 matrix
> sum_c2 = sum(mat(:,2)) // 2nd column of sum1 matrix
> sum_c3 = sum(mat(:,3)) // 3rd column of sum1 matrix
>
> ___
> 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


[Scilab-users] issue with "sum"

2016-09-27 Thread paul . carrico
Hi again

In the following example, the sum lead to an opposite sign for the complex part 
… Am I doing something wrong ?

thanks for any highlight

Paul


mode(0)

A = [
- 3.
6.123D-17
3.
- 3.
- 3.062D-17 - 5.303D-17*%i
- 1.5 + 2.5980762*%i
- 3.
- 3.062D-17 + 5.303D-17*%i
 - 1.5 - 2.5980762*%i]

mat = matrix(A,3,3)

sum1 = sum(mat,'r')' // reference matrix

sum_c1 = sum(mat(:,1)) // sum of the 1rst column of sum1 matrix
sum_c2 = sum(mat(:,2)) // 2nd column of sum1 matrix
sum_c3 = sum(mat(:,3)) // 3rd column of sum1 matrix

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


Re: [Scilab-users] is vectorization possible

2016-09-27 Thread paul . carrico
thanks to both of you

I works now

Paul

###
mode(0)

k = 1E6;
a = rand(k,1);

w = 2;
n = (k/w);


// same using a loop
tic()
tmp2 = zeros(n,1);
for i = 1 : n
tmp2(i,1) = sum(a([1 + (i-1)*w : i*w],:));
end
duree_loop = toc()

// using vectorization
tic()
tmp = zeros(n,1);
tmp = sum(matrix(a,w,n),'r')';
duree_vectorization = toc()


max_error = max(abs(tmp - tmp2))

- Mail original -
De: "ol.bond" 
À: users@lists.scilab.org
Envoyé: Mardi 27 Septembre 2016 09:59:12
Objet: Re: [Scilab-users] is vectorization possible



As just mentioned by Tim, you have to transform your vector 'a' to a matrix, 
and then apply summation: 


tmp = sum(matrix(a,w,n)','c'); 







2016-09-27 16:56 GMT+09:00 Tim Wescott [via Scilab / Xcos - Mailing Lists 
Archives] < [hidden email] > : 


OK. I think I see where I went wrong. 

There's a way to do this but it's a bit mind boggling. 

If you can let ix be a rectangular matrix of indexes, then a(ix) will be 
a column vector of indexed values. Then you can use 'matrix' to 
reassembly a(ix) into a rectangular matrix, the rows or columns of which 
you can sum up. I don't know if it'll be faster than the for loop, 
though. 

There may be an even better way of doing it, but I don't know what it 
is. 



On 2016-09-27 00:28, [hidden email] wrote: 


> Thanks Tim for the answer, nevertheless it cannot work. 
> 
> I want to make the sum of blocks of rows; here 
> - 'i' is a vector 
> - tmp is a vector of 20 rows in the current example 
> - the loop does the job, but I do not understand why the vectorization 
> fails ... is it a synthax error ? 
> 
> Paul 
> 
> pb: in my understanding, 'c' means 'column' and 'r' means row => for 
> matrix operations 
> 
> 
> 
> - Mail original - 
> De: "Tim Wescott" < [hidden email] > 
> À: [hidden email] 
> Envoyé: Mardi 27 Septembre 2016 09:17:30 
> Objet: Re: [Scilab-users] is vectorization possible 
> 
> tmp = sum(a( [1 + (i-1)*n : i*n],:), 'c') 
> 
> Or sum(..., 'r'). I can't remember which is which. One makes a row, 
> the other makes a column, but I can never remember if it's "sum all 
> columns" or "sum into a column". 
> 
> On Tue, 2016-09-27 at 09:08 +0200, [hidden email] wrote: 
>> Hi All 
>> 
>> Is the vectorization possible for the example herebellow? everything I 
>> tried failed ! 
>> 
>> Thanks for any help 
>> 
>> Paul 
>> 
>> ## 
>> mode(0) 
>> 
>> 
>> k = 100; 
>> a = rand(k,1); 
>> 
>> 
>> w = 5; 
>> n = (k/w); 
>> 
>> 
>> i = [1 : n]'; 
>> 
>> 
>> tmp = zeros(n,1); 
>> 
>> 
>> // using vectorization 
>> tmp(i,1) = sum(a( [1 + (i-1)*n : i*n],:) 
>> abort 
>> 
>> 
>> 
>> 
>> // same using a loop 
>> for i = 1 : n 
>> tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:)); 
>> end 
>> 
>> 
>> tmp 
>> ___ 
>> users mailing list 
>> [hidden email] 
>> http://lists.scilab.org/mailman/listinfo/users 
> 
> -- 
> 
> Tim Wescott 
> www.wescottdesign.com 
> Control & Communications systems, circuit & software design. 
> Phone:  target="_blank">503.631.7815 
> Cell:  target="_blank">503.349.8432 
> 
> 
> ___ 
> users mailing list 
> [hidden email] 
> http://lists.scilab.org/mailman/listinfo/users 
> ___ 
users mailing list 
[hidden email] 
http://lists.scilab.org/mailman/listinfo/users 







If you reply to this email, your message will be added to the discussion below: 
http://mailinglists.scilab.org/Scilab-users-is-vectorization-possible-tp4034639p4034644.html
 


To start a new topic under Scilab users - Mailing Lists Archives, email [hidden 
email] 
To unsubscribe from Scilab users - Mailing Lists Archives, click here . 
NAML 


View this message in context: Re: is vectorization possible 
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] is vectorization possible

2016-09-27 Thread paul . carrico
Thanks Tim for the answer, nevertheless it cannot work.

I want to make the sum of blocks of rows; here 
- 'i' is a vector
- tmp is a vector of 20 rows in the current example
- the loop does the job, but I do not understand why the vectorization fails 
... is it a synthax error ?

Paul

pb: in my understanding, 'c' means 'column' and 'r' means row => for matrix 
operations



- Mail original -
De: "Tim Wescott" 
À: users@lists.scilab.org
Envoyé: Mardi 27 Septembre 2016 09:17:30
Objet: Re: [Scilab-users] is vectorization possible

tmp = sum(a( [1 + (i-1)*n : i*n],:), 'c')

Or sum(..., 'r').  I can't remember which is which.  One makes a row,
the other makes a column, but I can never remember if it's "sum all
columns" or "sum into a column".

On Tue, 2016-09-27 at 09:08 +0200, paul.carr...@free.fr wrote:
> Hi All
> 
> Is the vectorization possible for the example herebellow? everything I
> tried failed !
> 
> Thanks for any help
> 
> Paul
> 
> ##
> mode(0)
> 
> 
> k = 100;
> a = rand(k,1);
> 
> 
> w = 5;
> n = (k/w);
> 
> 
> i = [1 : n]';
> 
> 
> tmp = zeros(n,1);
> 
> 
> // using vectorization
> tmp(i,1) = sum(a( [1 + (i-1)*n : i*n],:)
> abort
> 
> 
> 
> 
> // same using a loop
> for i = 1 : n
> tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:));
> end
> 
> 
> tmp
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432


___
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


[Scilab-users] is vectorization possible

2016-09-27 Thread paul . carrico
Hi All 

Is the vectorization possible for the example herebellow? everything I tried 
failed ! 

Thanks for any help 

Paul 

## 


mode(0) 


k = 100; 
a = rand(k,1); 


w = 5; 
n = (k/w); 


i = [1 : n]'; 


tmp = zeros(n,1); 


// using vectorization 
tmp(i,1) = sum(a( [1 + (i-1)*n : i*n],:) 
abort 




// same using a loop 
for i = 1 : n 
tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:)); 
end 


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


Re: [Scilab-users] fourier series and fft

2016-09-23 Thread paul . carrico
sound interesting ... many thanks for the information 


Paul 

- Mail original -

De: "Rafael Guerra"  
À: "Users mailing list for Scilab"  
Envoyé: Vendredi 23 Septembre 2016 13:57:31 
Objet: Re: [Scilab-users] fourier series and fft 



Hi Paul, 

Fyi, Tom Co's simple tutorial: http://www.chem.mtu.edu/~tbco/cm416/fft1.pdf 
shows how to obtain the Fourier coefficients via the fft 

Regards, 
Rafael 

-Original Message- 
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of 
paul.carr...@free.fr 
Sent: Friday, September 23, 2016 8:45 AM 
To: t...@wescottdesign.com; Users mailing list for Scilab 
 
Subject: Re: [Scilab-users] fourier series and fft 

Thanks Tim for this answer; well I notice I need to "dig" deeper on that topic 

Paul 

- Mail original -


De: "Tim Wescott " < t...@wescottdesign.com > 
À: "Users mailing list for Scilab" < users@lists.scilab.org > 
Envoyé : Jeudi 22 Septembre 2016 23:17:27 
Objet: Re: [Scilab-users] fourier series and fft 

Hey Paul: 

If you mean the Fourier series of a continuous-time periodic signal (or 
a continuous-time function of finite scope), then no, Scilab doesn't do 
that, because the FFT is different from the Fourier Series. If you have 
a signal that's symbolically defined as f(t) over some span of time, 
then Maxima may help you get a symbolic definition of the Fourier 
Series. 

The FFT is essentially the Fourier series of a sampled-time periodic (or 
finite-scope) signal, so if that sampled-time signal is a sufficiently 
accurate approximation of your continuous-time signal, and if your a0, 
a_k and b_k are defined to match the way that Scilab does the FFT , then 
the real part of the FFT are the a coefficients, and the imaginary part 
are the b coefficients. 

If you gather up half a dozen books that include signal processing, 
especially if some are from applications areas a bit removed from 
"normal" signal processing, you'll find that everyone specifies their 
Fourier stuff differently. So what comes out of Scilab's FFT may not 
match _your_ definitions of a0, etc., but they match _someone's_. 

On Thu, 2016-09-22 at 23:09 +0200, paul.carr...@free.fr wrote: 
> dear all 
> 
> I'm novice in Fourier series and other and my question is probably 
> naive (sorry for this) => I'm wondering if scilab can directly 
> calculate the Fourier coefficient a0, a_k and b_k ? 
> 
> 
> I'm currently doing it "by hand" is order to familiarise myself with 
> it (and I'm looking at the same time to documents on FFT use and 
> rules to refind the 2 natural frequencies of the example here bellow), 
> but it seems I'll need to code the coefficient calculations ... Am I 
> right ? 
> 
> Thanks 
> 
> Paul 

___ 
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] fourier series and fft

2016-09-22 Thread paul . carrico
Thanks Tim for this answer; well I notice I need to "dig" deeper on that topic

Paul

- Mail original -
De: "Tim Wescott" 
À: "Users mailing list for Scilab" 
Envoyé: Jeudi 22 Septembre 2016 23:17:27
Objet: Re: [Scilab-users] fourier series and fft

Hey Paul:

If you mean the Fourier series of a continuous-time periodic signal (or
a continuous-time function of finite scope), then no, Scilab doesn't do
that, because the FFT is different from the Fourier Series.  If you have
a signal that's symbolically defined as f(t) over some span of time,
then Maxima may help you get a symbolic definition of the Fourier
Series.

The FFT is essentially the Fourier series of a sampled-time periodic (or
finite-scope) signal, so if that sampled-time signal is a sufficiently
accurate approximation of your continuous-time signal, and if your a0,
a_k and b_k are defined to match the way that Scilab does the FFT, then
the real part of the FFT are the a coefficients, and the imaginary part
are the b coefficients.

If you gather up half a dozen books that include signal processing,
especially if some are from applications areas a bit removed from
"normal" signal processing, you'll find that everyone specifies their
Fourier stuff differently.  So what comes out of Scilab's FFT may not
match _your_ definitions of a0, etc., but they match _someone's_.

On Thu, 2016-09-22 at 23:09 +0200, paul.carr...@free.fr wrote:
> dear all
> 
> I'm novice in Fourier series and other and my question is probably
> naive (sorry for this) => I'm wondering if scilab can directly
> calculate the Fourier coefficient a0, a_k and b_k ?
> 
> 
> I'm currently doing it "by hand" is order to familiarise myself with
> it (and I'm looking at the same time to documents on  FFT use and
> rules to refind the 2 natural frequencies of the example here bellow),
> but it seems I'll need to code the coefficient calculations ... Am I
> right ?
> 
> 
> 
> Thanks
> 
> 
> Paul
> 
> 
> #
> mode(0)
> 
> function y=f(x)
> y=2.*sin(2 * %pi * x) - 3.*cos(%pi * x);
> endfunction
> 
> periode = 2;
> number_of_periodes = 1;
> n = periode * number_of_periodes;
> 
> x = [0 : %pi/100 : n]';
> y = f(x);
> N = size(x,"*");
> 
> scf()
> plot2d(x,y);
> 
> a = fft(y,-1);
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432


___
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


[Scilab-users] fourier series and fft

2016-09-22 Thread paul . carrico
dear all 

I'm novice in Fourier series and other and my question is probably naive (sorry 
for this) => I'm wondering if scilab can directly calculate the Fourier 
coefficient a0, a_k and b_k ? 


I'm currently doing it "by hand" is order to familiarise myself with it (and 
I'm looking at the same time to documents on FFT use and rules to refind the 2 
natural frequencies of the example here bellow), but it seems I'll need to code 
the coefficient calculations ... Am I right ? 



Thanks 


Paul 


# 
mode ( 0 ) function y = f ( x ) y = 2. * sin ( 2 * %pi * x ) - 3. * cos ( %pi * 
x ) ; endfunction periode = 2 ; number_of_periodes = 1 ; n = periode * 
number_of_periodes ; x = [ 0 : %pi / 100 : n ] ' ; y = f ( x ) ; N = size ( x , 
" * " ) ; scf ( ) plot2d ( x , y ) ; a = fft ( y , - 1 ) ; ___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab - Arduino

2016-09-06 Thread paul . carrico
Nicolay,

Thanks for the information (good way to start both with Arduino & Xcos)

Paul

- Mail original -
De: "Nikolay Strelkov" 
À: "Users mailing list for Scilab" 
Envoyé: Lundi 5 Septembre 2016 22:56:49
Objet: Re: [Scilab-users] Scilab - Arduino






Dear Paul! 

I'm on Ubuntu 12.04.5 LTS amd64 with binary Scilab 5.5.2 amd64. 


I downloaded Arduino toolbox from link in this comment ( Francisco-Ronay 
Lopez-estrada -- July 16, 2015, 07:51:43 PM ) - Arduino linux3.zip . 

I extracted this zip-archive to my SCIHOME directory ( 
/home/nikolay/.Scilab/scilab-5.5.2 ), then launched builder.sce and then added 
loader.sce to autoload by creating /home/nikolay/.Scilab/scilab-5.5.2/.scilab 
with the following line: 
exec(' /home/nikolay/.Scilab/scilab-5.5.2/ linux3/loader.sce',-1); 

Then I restarted Scilab and Arduino toolbox loaded with messages: 
Startup execution: 
loading initial environment 
Start Arduino 
Load macros 
Load serial dll 
Shared archive loaded. 
Link done. 
Load palette 
Load help 
Load demos 
Arduino Version: 1.2 
--> 


In Ubuntu your user should be a member of dialout group - sudo adduser $USER 
dialout . 

For better Scilab usability I suggest to use light window manager theme, for 
example Radiance. 
After this you can use Arduino with Xcos. 

You can vote for official linux port of Arduino toolbox on forge . 



Hope this helps. 













-- 

With best regards, 
Ph.D., assistant professor at MPEI , 
IEEE member, 
maintainer of Mathieu functions toolbox for Scilab , 
Nikolay Strelkov. 


2016-09-05 23:30 GMT+03:00 < paul.carr...@free.fr > : 


Scilab 5.5.2 for me ... the latest stable release 


- Mail original - 
De: "Samuel Gougeon" < sgoug...@free.fr > 
À: "Users mailing list for Scilab" < users@lists.scilab.org > 
Envoyé: Lundi 5 Septembre 2016 21:43:36 
Objet: Re: [Scilab-users] Scilab - Arduino 





Hello, 

Le 05/09/2016 21:22, Claus Futtrup a écrit : 



Hi Paul 

It's not necessary to download and install offline. 

When you look at the website for the module, it says: 


Category 
Instruments Control 
This means, open ATOMS, go to Instruments Control ... that's where you should 
be able to find the Arduino package. 

I haven't checked if it exist in ATOMS there ... but if you don't find the 
package there, please report it as a bug to Scilab. 
. 
I guess that Paul is running either Scilab 5.5 or Scilab 6, whereas the 
"arduino" module is not yet packaged for Scilab 6 (neither the 1.2 nor the 1.3 
releases): "This toolbox is in the process of being built" => no binary 
available... And was formerly available for Scilab 5.4 but not 5.5. 

New versioning and filtering rules applying since end of june then make Arduino 
available only from Scilab 5.4. 
These rules kill the usage of many Scilab 5 resources. 
It is quite hard to think that this evolution is not intentional. It was 
perfectly anticipable. 

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
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab - Arduino

2016-09-05 Thread paul . carrico
Scilab 5.5.2 for me ... the latest stable release


- Mail original -
De: "Samuel Gougeon" 
À: "Users mailing list for Scilab" 
Envoyé: Lundi 5 Septembre 2016 21:43:36
Objet: Re: [Scilab-users] Scilab - Arduino



Hello, 

Le 05/09/2016 21:22, Claus Futtrup a écrit : 



Hi Paul 

It's not necessary to download and install offline. 

When you look at the website for the module, it says: 


Category 
Instruments Control 
This means, open ATOMS, go to Instruments Control ... that's where you should 
be able to find the Arduino package. 

I haven't checked if it exist in ATOMS there ... but if you don't find the 
package there, please report it as a bug to Scilab. 
. 
I guess that Paul is running either Scilab 5.5 or Scilab 6, whereas the 
"arduino" module is not yet packaged for Scilab 6 (neither the 1.2 nor the 1.3 
releases): "This toolbox is in the process of being built" => no binary 
available... And was formerly available for Scilab 5.4 but not 5.5. 

New versioning and filtering rules applying since end of june then make Arduino 
available only from Scilab 5.4. 
These rules kill the usage of many Scilab 5 resources. 
It is quite hard to think that this evolution is not intentional. It was 
perfectly anticipable. 

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] Scilab - Arduino

2016-09-05 Thread paul . carrico
I do not find it (see screenshot), but in the meantime I noticed it works only 
under Windows OS ... and I'm under linux/ubuntu!!

It's a pitty :-)

In any way thanks for your support Claus

Paul

- Mail original -
De: "Claus Futtrup" 
À: users@lists.scilab.org
Envoyé: Lundi 5 Septembre 2016 21:22:14
Objet: Re: [Scilab-users] Scilab - Arduino



Hi Paul 

It's not necessary to download and install offline. 

When you look at the website for the module, it says: 


Category 
Instruments Control 
This means, open ATOMS, go to Instruments Control ... that's where you should 
be able to find the Arduino package. 

I haven't checked if it exist in ATOMS there ... but if you don't find the 
package there, please report it as a bug to Scilab. 

Best regards, 
Claus 

On 05-09-2016 21:09, paul.carr...@free.fr wrote: 


Hi Claus,

First thanks for the answer.

I was looking to install it from the Atoms interface directly in Scilab ... I 
can understand now it's necessary to download the tarball and to install it.

Paul

- Mail original -
De: "Claus Futtrup"  À: users@lists.scilab.org Envoyé: 
Lundi 5 Septembre 2016 19:54:27
Objet: Re: [Scilab-users] Scilab - Arduino

Hi Paul

I found this: https://atoms.scilab.org/toolboxes/arduino/1.3/ /Claus

On 05-09-2016 19:46, paul.carr...@free.fr wrote: 

Hi,

I looking into Atoms to the package "Scilab-Arduino" from demosciences but I 
fail in finding it: is the package still available or am I doing something 
wrong?

Thanks

Paul
___
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 



___
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] Scilab - Arduino

2016-09-05 Thread paul . carrico
Hi Claus,

First thanks for the answer.

I was looking to install it from the Atoms interface directly in Scilab ... I 
can understand now it's necessary to download the tarball and to install it.

Paul

- Mail original -
De: "Claus Futtrup" 
À: users@lists.scilab.org
Envoyé: Lundi 5 Septembre 2016 19:54:27
Objet: Re: [Scilab-users] Scilab - Arduino

Hi Paul

I found this: https://atoms.scilab.org/toolboxes/arduino/1.3/

/Claus

On 05-09-2016 19:46, paul.carr...@free.fr wrote:
> Hi,
>
> I looking into Atoms to the package "Scilab-Arduino" from demosciences but I 
> fail in finding it: is the package still available or am I doing something 
> wrong?
>
> Thanks
>
> Paul
> ___
> 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


[Scilab-users] Scilab - Arduino

2016-09-05 Thread paul . carrico
Hi,

I looking into Atoms to the package "Scilab-Arduino" from demosciences but I 
fail in finding it: is the package still available or am I doing something 
wrong?

Thanks

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


[Scilab-users] vectorization issue

2016-06-16 Thread paul . carrico
Dear, 

I failed in using 100% vectorization in the following example (and I don't 
remember how to proceed) ; I spent a lot of time in testing things ... 


... what is the correct sentence for vecteur2 


Thanks for the help 


Paul 


##
 
mode ( 0 ) t = 0 : 0.1 : %pi ; [ l , n ] = size ( t ) ; mat_sin = [ t ' sin ( t 
' ) ] ; 
scalaire = intsplin ( mat_sin ( : , 1 ) , mat_sin ( : , 2 ) ) ; // with a loop 
vecteur = zeros ( n - 1 , 2 ) ; for j = 2 : n vecteur ( j - 1 , : ) = [ mat_sin 
( j - 1 , 1 ) intsplin ( mat_sin ( [ 1 : j ] , 1 ) , mat_sin ( [ 1 : j ] , 2 ) 
) ] ; end plot2d ( vecteur ( : , 1 ) , vecteur ( : , 2 ) ) pause // pure 
vectorisation i = [ 1 : n ] ' j = [ 2 : n ] ' vecteur2 = zeros ( n - 1 , 2 ) ; 
vecteur2 = [ mat_sin ( i , 1 ) intsplin ( mat_sin ( [ 1 : j ] , 1 ) , mat_sin ( 
[ 1 : j ] , 2 ) ) ] ___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Re : Re: {EXT} create random values between [-1,1]

2016-06-10 Thread paul . carrico
Thanks everybody for the advices

Paul
- Mail d'origine -
De: Jan Åge Langeland 
À: Users mailing list for Scilab 
Envoyé: Fri, 10 Jun 2016 16:55:21 +0200 (CEST)
Objet: Re: [Scilab-users] {EXT} create random values between [-1,1]

I suggest a normal distribution:

histplot(10,10+grand(1,1000,"nor",0,.01))

Jan Å


On 10.06.2016 16:41, Dang Ngoc Chan, Christophe wrote:
> Hello,
>
>> De : De la part de Dang Ngoc Chan, Christophe
>> Envoyé : vendredi 10 juin 2016 15:38
>>
>> AFAIK, the sum of two random values following a normal
> Reading the other contributions, I realised I misread the code.
> However, I can't imagine a production process (milling, lathe machining or 
> whatever) giving a uniform distribution for the dimensions .
>
> But maybe "dimensional tolerances" does not concern machining.
>
> --
> 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
>

___
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] matrix of combinations

2016-06-09 Thread paul . carrico
Hi samuel,

(thanks) 

I'm still under the latest stable Scilab release 5.5.x ... but it sounds a good 
opportunity to move to 6.0 one.

I've 2 servers (both under CentOS) having different features :
- 2 CPU-s with 120 Go of memory
- 8 CPU's with 30 Go of memory

the latest one is probably the more interesting for the current application :-)

I'll have a look to the scidoe module

Paul

- Mail original -
De: "Samuel Gougeon" 
À: "Users mailing list for Scilab" 
Envoyé: Jeudi 9 Juin 2016 18:10:36
Objet: Re: [Scilab-users] matrix of combinations



Hello Paul, 

Le 09/06/2016 17:28, Carrico, Paul a écrit : 





Dear all 



(not sure to really master the topic but …) 



In my current study, I’ve 16 variables that I would like to perturbate 10 times 
; of course each variable is different from the others. 

A1 = 10 + 2*rand(10,1,”uniform”) 

A2 = 5 + 0.5*rand(10,1,”uniform”) 

… 

A16 = 0.2 +0.01**rand(10,1,”uniform”) 





Except if I’m mistaken, I’ve about 16^10=1E12 combinations that is a (16xn) 
huge matrix M (n greater than 6E10) : how can I create such matrix ? It depends 
how you build a sample: is a sample a {A1(i), A2(j),..., A16(x)} set? 
Then, there are 10^16 possibilities. 
You can build them with ndgrid(), provided that you have hexabytes of RAM, 
(really) many processors, and of course Scilab 6. Do you? :) 
Or you may have a look at DOE theory, and tools: 
https://atoms.scilab.org/toolboxes/scidoe 

BR 
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


[Scilab-users] Re : Re: Re : Re: opposite to 'diag' keyword

2015-06-17 Thread paul . carrico
oups

I probably did something wrong when I tested it ...

Thanks

Paul
- Mail d'origine -
De: Pierre-Aimé Agnel 
À: users@lists.scilab.org
Envoyé: Wed, 17 Jun 2015 09:28:38 +0200 (CEST)
Objet: Re: [Scilab-users] Re : Re:  opposite to 'diag' keyword

Hello,

diag works both ways:


Le 17/06/2015 09:22, paul.carr...@free.fr a écrit :
> No
>
> A basic example:
>
> -->A = [1 0 0 0 ; 0 6 0 0 ; 0 0 -5 0 ; 0 0 0 31]
>   A  =
>   
>  1.0.0.0.
>  0.6.0.0.
>  0.0.  - 5.0.
>  0.0.0.31.
>   
> -->B = diag(A)
>   B  =
>   
>  1.
>  6.
>- 5.
>  31.
>   

-->A = [1 0 0 0 ; 0 6 0 0 ; 0 0 -5 0 ; 0 0 0 31]
  A  =

 1.0.0.0.
 0.6.0.0.
 0.0.  - 5.0.
 0.0.0.31.

-->B = diag(A)
  B  =

 1.
 6.
   - 5.
 31.

-->C = diag(B)
  C  =

 1.0.0.0.
 0.6.0.0.
 0.0.  - 5.0.
 0.0.0.31.
>
> how a rebuild A from B 
>
> NB:
> - the purpose is to find a basic but fast way to build a symmetrical matrix 
> using the following syntax for example : K = K +Kd + K'
> - where K is the triangle upper (or lower) matrix and Kd is the diagonal
> - I want to decrease the amount of memory in avoiding to use a (nxn) matrix
>
>
> Paul
>
> - Mail d'origine -
> De: jbaud...@insa-rennes.fr 
> À: users@lists.scilab.org
> Envoyé: Wed, 17 Jun 2015 09:14:39 +0200 (CEST)
> Objet: Re: [Scilab-users] opposite to 'diag' keyword
>
> Hello,
>
> Le 17/06/2015 09:05, paul.carr...@free.fr a écrit :
>> The question is quite basic: I'm trying to opposite to 'diag' keyword in 
>> order to build a diagonal matrix from a vector, but I fail so far ... what 
>> is the trick?
> The diag help says "diagonal including or extracting"
>   > diag([1 2])
> gives the matrix [1 0;0 2]
> Is it the "opposite" you want?
>
> --Jean-Yves
> ___
> 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

-- 
Pierre-Aimé Agnel
R&D Projects Manager
Phone:  +33.1.80.77.04.67
Mobile: +33.6.82.49.35.23
---
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
http://www.scilab-enterprises.com


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


[Scilab-users] Re : Re: opposite to 'diag' keyword

2015-06-17 Thread paul . carrico
No

A basic example:

-->A = [1 0 0 0 ; 0 6 0 0 ; 0 0 -5 0 ; 0 0 0 31]
 A  =
 
1.0.0.0.   
0.6.0.0.   
0.0.  - 5.0.   
0.0.0.31.  
 
-->B = diag(A)
 B  =
 
1.   
6.   
  - 5.   
31.  
 

how a rebuild A from B  

NB: 
- the purpose is to find a basic but fast way to build a symmetrical matrix 
using the following syntax for example : K = K +Kd + K'
- where K is the triangle upper (or lower) matrix and Kd is the diagonal
- I want to decrease the amount of memory in avoiding to use a (nxn) matrix


Paul

- Mail d'origine -
De: jbaud...@insa-rennes.fr 
À: users@lists.scilab.org
Envoyé: Wed, 17 Jun 2015 09:14:39 +0200 (CEST)
Objet: Re: [Scilab-users] opposite to 'diag' keyword

Hello,

Le 17/06/2015 09:05, paul.carr...@free.fr a écrit :
> The question is quite basic: I'm trying to opposite to 'diag' keyword in 
> order to build a diagonal matrix from a vector, but I fail so far ... what is 
> the trick?

   The diag help says "diagonal including or extracting"
 > diag([1 2])
gives the matrix [1 0;0 2]
   Is it the "opposite" you want?

--Jean-Yves
___
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


[Scilab-users] opposite to 'diag' keyword

2015-06-17 Thread paul . carrico
Dear All,

The question is quite basic: I'm trying to opposite to 'diag' keyword in order 
to build a diagonal matrix from a vector, but I fail so far ... what is the 
trick?

Thanks

Paul

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


[Scilab-users] equivalent to eigs in scilab

2015-06-10 Thread paul . carrico
Dear All

I get a Matlab file and I would like to know what is the equivalent to

Matlab:
n = 6;
[u,v]=eigs(K,M,n,'SM'); // where K and U and 2 sparse matrix
//'SM' means Smallest for my understanting -> looking 
for the 6th lower eigen values, isn't it ?

Scilab:
Spec or bdiag seems to be equivalent, but I failed in using them 

How should I to proceed ?

Thanks

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


[Scilab-users] Re : for-loop does't work

2015-06-05 Thread paul . carrico
hi

Maybe you should first explain what you would like to do ...

A is a matrix 151x3
x is a matrix 1x5

I do not understand the prupose of the loop

Depending on what you are expecting for, a good solution will be found

Paul

- Mail d'origine -
De: fujimoto2005 
À: users@lists.scilab.org
Envoyé: Fri, 05 Jun 2015 12:36:58 +0200 (CEST)
Objet: [Scilab-users] for-loop does't work

I run the following script.
It works at 4th line
But It failes from 5th line to 7th line.
It seems to be right
Where is this script wrong?

***
A=zeros(151,3);
x=[0.0  5.0 10.015.019.0]
i=5
A(1,:)=x(i)
for i=1:5
A(1,:)=x(i); 
end



--
View this message in context: 
http://mailinglists.scilab.org/for-loop-does-t-work-tp4032382.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


[Scilab-users] Re : Re: Command lauch using a string

2015-05-15 Thread paul . carrico
Dear Stefan

You're right it was a quote issue - thanks to you and Antine for the suggestions

Paul


- Mail d'origine -
De: Stefan Du Rietz 
À: users@lists.scilab.org
Envoyé: Fri, 15 May 2015 10:07:48 +0200 (CEST)
Objet: Re: [Scilab-users] Command lauch using a string

On 2015-05-14 22:51, paul.carr...@free.fr wrote:
> Dear All,
>
> I've been thinking in creating a string in order to run specific instructions 
> afterward (I'm under Windows OS for the moement);
>
> An example of my code:
> #
> A = 'PATH_IMAGEMAGICK + ''\convert -delay 50 ';
> for i = 1 : number
>  A = A + '-repage 1218x722+0+0 sample_geometry" + string(i) + ".gif ';
> end
> A = A + '-loop 0 superposition_anime.gif'',''-echo''';
> dos(A)
> #
>
> It fails while if I replace the string A by the complete sentence, it works 
> fine showing that's probably a format issue ... but honnestly I don't find 
> the right one
>
> Any suggestion will be appreciated
>
> Thanks
>
> Paul
>
Have you tried to display the string A in Scilab?

-->PATH_IMAGEMAGICK = "c:\Path\to\Imagemagick"
  PATH_IMAGEMAGICK  =
  c:\Path\to\Imagemagick

// This is probably not what you want:
-->A = 'PATH_IMAGEMAGICK + ''\convert -delay 50 '
  A  =
  PATH_IMAGEMAGICK + '\convert -delay 50

// You probably want this:
-->A = PATH_IMAGEMAGICK + '\convert -delay 50 '
  A  =
  c:\Path\to\Imagemagick\convert -delay 50

Regards
Stefan

___
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


[Scilab-users] Command lauch using a string

2015-05-14 Thread paul . carrico
Dear All,

I've been thinking in creating a string in order to run specific instructions 
afterward (I'm under Windows OS for the moement); 

An example of my code:
#
A = 'PATH_IMAGEMAGICK + ''\convert -delay 50 ';
for i = 1 : number
A = A + '-repage 1218x722+0+0 sample_geometry" + string(i) + ".gif ';
end
A = A + '-loop 0 superposition_anime.gif'',''-echo''';
dos(A)
#

It fails while if I replace the string A by the complete sentence, it works 
fine showing that's probably a format issue ... but honnestly I don't find the 
right one

Any suggestion will be appreciated

Thanks

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


[Scilab-users] MMA / GCMMA (optimization method)

2015-05-04 Thread paul . carrico
Dear All

I take here the initiative to ask advices on MMA/GCMMA method ... both in 
understanding it and after how to code it in Scilab.

So far I used optimizer(s) while I'm knowing the cost function (typically Sum 
Of the Square Errors SSE in order to fit measurements); For design optimization 
purpose using FEM solvers, It's quite often difficult to determine this cost 
function. 

An interesting French Book from JC Craveur et al (see EAN13 9782100600229) 
introduces this kind of issue speaking about the family of MMA methods (MMA / 
GCMMA / GBMMA) in order to create  and solve a set of sub-problems and then to 
master this kind of optimization topic ...

I do not measure the difficulties behind it and that's why I'm asking for 
feedbacks, so thanks in advance for it

NB:
- I found the Krister Svanberg articles for the GCMMA method in currently 
studying
- I know that pyopt librairies include MMA and GCMMA method


Thanks

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


[Scilab-users] Re : Re: Envelop of a noisy curve

2015-04-26 Thread paul . carrico
Dear

Thanks everybody for the suggestions  that (even it can be used as it stands) 
have been a great source of inspiration to fix my issue.

Regards

Paul


- Mail d'origine -
De: Samuel Gougeon 
À: International users mailing list for Scilab. 
Envoyé: Fri, 24 Apr 2015 21:03:23 +0200 (CEST)
Objet: Re: [Scilab-users] Envelop of a noisy curve

Hello,
Le 24/04/2015 14:05, paul.carr...@free.fr a écrit :
> Dear All,
>
> I am absolutly not familiar with "signal processing" field, so my question is 
> probably naïve: how can I proceed to get the envelop curve (maximum values) 
> of a non periodic noisy signal ?
Here is an example and its result:

x  =  linspace(0,20,300);
y  =  exp((2-x)/5).*sin(x)+rand(x);
clf
plot2d(x,y)
e  =  gce();
e  =  e.children;
e.foreground  =  color("grey80");

d  =  diff(y)  ./  diff(x);
pmax  =  find(d(1:$-1)>=0  &  d(2:$)<0)+1;
pmin  =  find(d(1:$-1)<0  &  d(2:$)>0)+1;
// edges corrections
if  d(1)<0  then
 pmax  =  [1  pmax]
end
if  d($)<0  then
 pmin  =  [pmin  length(y)]
end
//
plot(x(pmax),y(pmax),"r",x(pmin),y(pmin),"b")


Zooming on that shows in some places the limits of this naive approach, 
to be refine.

Regards
Samuel



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


[Scilab-users] Envelop of a noisy curve

2015-04-24 Thread paul . carrico
Dear All,

I am absolutly not familiar with "signal processing" field, so my question is 
probably naïve: how can I proceed to get the envelop curve (maximum values) of 
a non periodic noisy signal ?

Thanks for any suggestion

Have a good WE

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


[Scilab-users] Real time acquisition in Scilab

2014-08-17 Thread paul . carrico
Dear All,

I'm a complete beginner in such item and I think it has ever been implemented 
in Scilab : what module can handle real time (signal) plotting ?
(google searches has been unsuccessfull using such words or close ones)

Thanks

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


Re: [Scilab-users] tic toc time

2014-05-25 Thread Paul CARRICO
toc() … i.e with () …  instead of toc



Paul



De : users [mailto:users-boun...@lists.scilab.org] De la part de Claus
Futtrup
Envoyé : dimanche 25 mai 2014 12:21
À : International users mailing list for Scilab.
Objet : [Scilab-users] tic toc time



Hi there

Converting from matlab to scilab is finished, but the matlab code contains a
tic toc (begin/end of script timer).

The Scilab code doesn't display anything.

I thought I'd go like this (based on example from the Scilab manual):

tic();
realtimeinit(1);
realtime(0);
realtime(10);
t = toc;
printf("Time (tic-toc) %f \n",t);

That doesn't work.

How do I make Scilab display the registered time ???

/Claus



  _


 

This email is free from viruses and malware because avast! Antivirus
  protection is active.





---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] RE(2): finding roots

2014-03-30 Thread Paul CARRICO
Thanks ... indeed much more stable ..

Paul

-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de Rafael Guerra
Envoyé : dimanche 30 mars 2014 23:34
À : 'International users mailing list for Scilab.'
Objet : [Scilab-users] RE(2): finding roots

Hi Paul,

The new code here below does not show any such problem for all N solutions I 
tried.
Note that your problem: cos(x) .* cosh(x) + 1 = 0; is equivalent to: cos(x) + 
sech(x) = 0.
The latter form seems to be numerically more stable.

Regards,
Rafael

// Solution using fsolve (RG, 30-Mar-2014)

function y=fsol1(x)
  y = cos(x) + sech(x);
endfunction

clc;
// solve for first N solutions:
N=25;
x0= linspace(%pi/2,%pi/2+(N-1)*%pi,N);

// plot problem to find where to define initial value guesses:
x=-x0($):0.1:x0($);
y1=cos(x);
y2=-sech(x);
clf;
plot(x,y1,'b',x,y2,'r');

Xsol=fsolve(x0,fsol1);
Y_verif = fsol1(Xsol); // should be equal/close to zero

printf("\n");
for i=1:N
  printf("X(%2i)= +/- %8.6f .",i,Xsol(i));
  printf("Y(%2i)= +/- %8.6f\n",i,Y_verif(i)); end

plot([-Xsol; Xsol],cos([-Xsol; Xsol]),"black*")


-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of 
paul.carr...@free.fr
Sent: Sunday, March 30, 2014 9:53 PM
To: International users mailing list for Scilab.
Subject: [Scilab-users] Re : Re: Re : finding roots

Thanks Rafael,

I've slightly modified your code, but I've an issue: the first root is found to 
1.969 whereas it's close to 1.8751, leading to wrong results  I do not 
figure out where's my mistake ... any suggestion ?

NB: after the 10th root, the roots seriously differ ...

Thanks

Paul



mode(0)

function y=fsol(x)
  y=cos(x). * cosh(x) + 1;
endfunction

// solve for first N solutions:
N=100;
x0 = [%pi/2 : %pi : %pi/2 + (N-1)*%pi]'; [nl,nc] = size(x0); 
[Xsol]=fsolve(x0,fsol,,%eps);

// print the results
for i=1:nl
  printf("X(%d)= %8.15f\n",i,Xsol(i));
end


// verification
X_verif = fsol(Xsol); // should be equal/close to zero


- Mail d'origine -
De: Rafael Guerra 
À: 'International users mailing list for Scilab.' 
Envoyé: Sun, 30 Mar 2014 14:01:19 +0200 (CEST)
Objet: Re: [Scilab-users] Re :  finding roots

Hi Paul,

Please try the solution below using fsolve.

Could you let us know why do you want to solve that equation? Is it just for 
fun or is there an underlying physical problem?

PS:
I was looking for a new version of Scilab and found a donate button, Scilab 
needs our help.

Regards
Rafael Guerra


// Solution using fsolve (RG, 30-Mar-2014)

function y=fsol1(x)
  y=cos(x).*cosh(x)+1;
endfunction

// plot problem to find where to define initial value guesses:
x=-20:0.1:20;
y1=cos(x);
y2=-sech(x);
clf;
plot(x,y1,'b',x,y2,'r');

// solve for first 10 solutions:
N=10;
x0= linspace(%pi/2,%pi/2+(N-1)*%pi,N);
[Xsol]=fsolve(x0,fsol1);
for i=1:N
  printf("X(%2i)= +/- %8.6f\n",i,Xsol(i)); end


-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of 
paul.carr...@free.fr
Sent: Sunday, March 30, 2014 10:48 AM
To: International users mailing list for Scilab.
Subject: [Scilab-users] Re : finding roots

Hooops I make a mistake :
cos(x)*cosh(x)+1=0

Paul

- Mail d'origine -
De: paul carrico 
À: International users mailing list for Scilab. 
Envoyé: Sun, 30 Mar 2014 11:30:23 +0200 (CEST)
Objet: [Scilab-users] finding roots

Dear All

I would like to find the first 10 roots of the following equation :
cos(x)*cosh(x)-1=0

I think the solution is not trivial and need a specific development, isn't it ?

Cheers

Paul
___
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

___
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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


[Scilab-users] Re : Re: Re : finding roots

2014-03-30 Thread paul . carrico
Thanks Rafael,

I've slightly modified your code, but I've an issue: the first root is found to 
1.969 whereas it's close to 1.8751, leading to wrong results ... I do not 
figure out where's my mistake ... any suggestion ?

NB: after the 10th root, the roots seriously differ ...

Thanks

Paul



mode(0)

function y=fsol(x)
  y=cos(x). * cosh(x) + 1;
endfunction

// solve for first N solutions:
N=100;
x0 = [%pi/2 : %pi : %pi/2 + (N-1)*%pi]';
[nl,nc] = size(x0);
[Xsol]=fsolve(x0,fsol,,%eps);

// print the results
for i=1:nl
  printf("X(%d)= %8.15f\n",i,Xsol(i));
end


// verification
X_verif = fsol(Xsol); // should be equal/close to zero


- Mail d'origine -
De: Rafael Guerra 
À: 'International users mailing list for Scilab.' 
Envoyé: Sun, 30 Mar 2014 14:01:19 +0200 (CEST)
Objet: Re: [Scilab-users] Re :  finding roots

Hi Paul,

Please try the solution below using fsolve.

Could you let us know why do you want to solve that equation? Is it just for 
fun or is there an underlying physical problem?

PS:
I was looking for a new version of Scilab and found a donate button, Scilab 
needs our help.

Regards
Rafael Guerra


// Solution using fsolve (RG, 30-Mar-2014)

function y=fsol1(x)
  y=cos(x).*cosh(x)+1;
endfunction

// plot problem to find where to define initial value guesses:
x=-20:0.1:20;
y1=cos(x);
y2=-sech(x);
clf;
plot(x,y1,'b',x,y2,'r');

// solve for first 10 solutions:
N=10;
x0= linspace(%pi/2,%pi/2+(N-1)*%pi,N);
[Xsol]=fsolve(x0,fsol1);
for i=1:N
  printf("X(%2i)= +/- %8.6f\n",i,Xsol(i));
end


-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of 
paul.carr...@free.fr
Sent: Sunday, March 30, 2014 10:48 AM
To: International users mailing list for Scilab.
Subject: [Scilab-users] Re : finding roots

Hooops I make a mistake :
cos(x)*cosh(x)+1=0

Paul

- Mail d'origine -
De: paul carrico 
À: International users mailing list for Scilab. 
Envoyé: Sun, 30 Mar 2014 11:30:23 +0200 (CEST)
Objet: [Scilab-users] finding roots

Dear All

I would like to find the first 10 roots of the following equation :
cos(x)*cosh(x)-1=0

I think the solution is not trivial and need a specific development, isn't it ?

Cheers

Paul
___
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

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


[Scilab-users] Re : Re: Re : finding roots

2014-03-30 Thread paul . carrico
Thanks Rafael,

I've slightly modified your code, but I've an issue: the first root is found to 
1.969 whereas it's close to 1.8751, leading to wrong results ... I do not 
figure out where's my mistake ... any suggestion ?

NB: after the 10th root, the roots seriously differ ...

Thanks

Paul



mode(0)

function y=fsol(x)
  y=cos(x). * cosh(x) + 1;
endfunction

// solve for first N solutions:
N=100;
x0 = [%pi/2 : %pi : %pi/2 + (N-1)*%pi]';
[nl,nc] = size(x0);
[Xsol]=fsolve(x0,fsol,,%eps);

// print the results
for i=1:nl
  printf("X(%d)= %8.15f\n",i,Xsol(i));
end


// verification
X_verif = fsol(Xsol); // should be equal/close to zero







- Mail d'origine -
De: Rafael Guerra 
À: 'International users mailing list for Scilab.' 
Envoyé: Sun, 30 Mar 2014 14:01:19 +0200 (CEST)
Objet: Re: [Scilab-users] Re :  finding roots

Hi Paul,

Please try the solution below using fsolve.

Could you let us know why do you want to solve that equation? Is it just for 
fun or is there an underlying physical problem?

PS:
I was looking for a new version of Scilab and found a donate button, Scilab 
needs our help.

Regards
Rafael Guerra


// Solution using fsolve (RG, 30-Mar-2014)

function y=fsol1(x)
  y=cos(x).*cosh(x)+1;
endfunction

// plot problem to find where to define initial value guesses:
x=-20:0.1:20;
y1=cos(x);
y2=-sech(x);
clf;
plot(x,y1,'b',x,y2,'r');

// solve for first 10 solutions:
N=10;
x0= linspace(%pi/2,%pi/2+(N-1)*%pi,N);
[Xsol]=fsolve(x0,fsol1);
for i=1:N
  printf("X(%2i)= +/- %8.6f\n",i,Xsol(i));
end


-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of 
paul.carr...@free.fr
Sent: Sunday, March 30, 2014 10:48 AM
To: International users mailing list for Scilab.
Subject: [Scilab-users] Re : finding roots

Hooops I make a mistake :
cos(x)*cosh(x)+1=0

Paul

- Mail d'origine -
De: paul carrico 
À: International users mailing list for Scilab. 
Envoyé: Sun, 30 Mar 2014 11:30:23 +0200 (CEST)
Objet: [Scilab-users] finding roots

Dear All

I would like to find the first 10 roots of the following equation :
cos(x)*cosh(x)-1=0

I think the solution is not trivial and need a specific development, isn't it ?

Cheers

Paul
___
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

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


[Scilab-users] Re : finding roots

2014-03-30 Thread paul . carrico
Hooops I make a mistake :
cos(x)*cosh(x)+1=0

Paul

- Mail d'origine -
De: paul carrico 
À: International users mailing list for Scilab. 
Envoyé: Sun, 30 Mar 2014 11:30:23 +0200 (CEST)
Objet: [Scilab-users] finding roots

Dear All

I would like to find the first 10 roots of the following equation :
cos(x)*cosh(x)-1=0

I think the solution is not trivial and need a specific development, isn't it ?

Cheers

Paul
___
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


[Scilab-users] finding roots

2014-03-30 Thread paul . carrico
Dear All

I would like to find the first 10 roots of the following equation :
cos(x)*cosh(x)-1=0

I think the solution is not trivial and need a specific development, isn't it ?

Cheers

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


Re: [Scilab-users] finding similar values with scilab

2014-02-22 Thread Paul CARRICO
I've ever suggested to use "awk" / "sed" and other linux tool (even under 
Windows) in conjunction to Scilab ;

1rst step : concatenate all the files if necessary (with Scilab for example)

Average :
http://azimuth.biz/2009/03/30/calculate-average-using-awk/

standard deviation :
http://azimuth.biz/2010/02/25/calculate-standard-deviation-using-awk/


Min-Max:
http://azimuth.biz/2010/10/20/find-minimum-and-maximum-using-awk/


supress values greater than : (ditto for min value)
http://www.unix.com/shell-programming-scripting/178904-awk-show-lines-where-nth-column-greater-than-some-number.html
http://oreilly.com/catalog/unixnut3/chapter/ch11.html


and so on

I'm not a awk/sed specialist, but I've a look to such tools when my input files 
have million's of lines ... and it works fine and fast !!!
Just an idea


NB: tutos
http://www.grymoire.com/Unix/Awk.html
http://www.cs.unibo.it/~renzo/doc/awk/nawkA4.pdf
etc. ...




-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de Paul CARRICO
Envoyé : samedi 22 février 2014 08:48
À : 'International users mailing list for Scilab.'
Objet : Re: [Scilab-users] finding similar values with scilab

Do you have to do this on a single file and to repeat it X times (where X is 
the thousands of file you're speaking) or do you have to calculate the 
deviation and so on) on the X files at the same time ?

Obviously the first case is much easier than the second one .



-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de samaelkreutz 
Envoyé : samedi 22 février 2014 00:26 À : users@lists.scilab.org Objet : Re: 
[Scilab-users] finding similar values with scilab

I need compute an iteration , but (obviously I don't know how to do it  =/  ) 
Read thousand of text files... then what I do is check the mean, stand.
deviation, and variation coefficient ( std/mean ). If the variation coefficient 
is <= 0.4, stop the process. If not, eliminate the big value and recalculate 
all the process again.

But i'm lost!!! because Im reading multiple text files and is confusing! 
Heeelp  




clc
clear all
z=[]; // genero mi matriz vacia que se ira llenando con el for  for i=103 
//35:2:37// 
 for j=2.6:0.1:3.9//
 DM = fscanfMat(msprintf("new-C1_%d_%3.1f.txt",i,j));
 //disp(i,j)
 med=mean(DM(:,3));
 std=st_deviation(DM(:,3));
 CV=std/abs(med);
 Z=[med std CV CV*100];
 z=[z;Z]; // Matriz con información requerida
 //figure(i);
 //plot(DM(:,1), DM(:,3), 'ro*') 
 end
 end
z




--
View this message in context: 
http://mailinglists.scilab.org/finding-similar-values-with-scilab-tp4028792p4028865.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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


Re: [Scilab-users] finding similar values with scilab

2014-02-21 Thread Paul CARRICO
Do you have to do this on a single file and to repeat it X times (where X is 
the thousands of file you're speaking) or do you have to calculate the 
deviation and so on) on the X files at the same time ?

Obviously the first case is much easier than the second one .



-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de samaelkreutz
Envoyé : samedi 22 février 2014 00:26
À : users@lists.scilab.org
Objet : Re: [Scilab-users] finding similar values with scilab

I need compute an iteration , but (obviously I don't know how to do it  =/  ) 
Read thousand of text files... then what I do is check the mean, stand.
deviation, and variation coefficient ( std/mean ). If the variation coefficient 
is <= 0.4, stop the process. If not, eliminate the big value and recalculate 
all the process again.

But i'm lost!!! because Im reading multiple text files and is confusing! 
Heeelp  




clc
clear all
z=[]; // genero mi matriz vacia que se ira llenando con el for  for i=103 
//35:2:37// 
 for j=2.6:0.1:3.9//
 DM = fscanfMat(msprintf("new-C1_%d_%3.1f.txt",i,j));
 //disp(i,j)
 med=mean(DM(:,3));
 std=st_deviation(DM(:,3));
 CV=std/abs(med);
 Z=[med std CV CV*100];
 z=[z;Z]; // Matriz con información requerida
 //figure(i);
 //plot(DM(:,1), DM(:,3), 'ro*') 
 end
 end
z




--
View this message in context: 
http://mailinglists.scilab.org/finding-similar-values-with-scilab-tp4028792p4028865.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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


Re: [Scilab-users] finding similar values with scilab

2014-02-21 Thread Paul CARRICO
Did you have a look to "awk" and "sed" tools that can be used in conjunction
with Scilab ?



-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de
samaelkreutz
Envoyé : vendredi 21 février 2014 06:18
À : users@lists.scilab.org
Objet : [Scilab-users] finding similar values with scilab

Hello!!! I have a big question !
I have a biiig data archive with text files with the form:

18.87 2.6 0.00545558
19.98 2.6 0.00225349
18.87 2.6 0.00405905
13.32 2.6 0.01338288
19.98 2.6 0.01537532
18.87 2.6 0.00481375
19.98 2.6 0.00936207
12.21 2.6 0.00558517

I need  eliminate extreme values, for example: If I plot a random text file
I obtain a image like this:

 

As you can see theres points extremes. If i make a zoom 

DN=find(DM(:,3)<=0.0001 & DM(:,3)>=0.2 )
dn=DM(DN,:)
figure(2)
plot(dn(:,1),dn(:,3),'O')

I have this picture

 


My question is: Has scilab a command that can help me to find the "dense
data" , I mean find all the values that are similar. I ask this cause I have
about 20,000 text files and is imposible for me make "artesal zoms".

Please any suggestion, answer going to help me. 




--
View this message in context:
http://mailinglists.scilab.org/finding-similar-values-with-scilab-tp4028792.
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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


Re: [Scilab-users] Loading multiple text files

2014-02-08 Thread Paul CARRICO
Note the "plot" line has been cut in 2 ones by outlook 

-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de Paul
CARRICO
Envoyé : samedi 8 février 2014 08:53
À : 'International users mailing list for Scilab.'
Objet : Re: [Scilab-users] Loading multiple text files

I haven't tested specifically your example, but I would use something like :

for i=1:1:4
str1 = "...
DM("+ string(i) +")=fscanfMat(''export_5-20HZ_C("+ string(i) +").txt''),...
figure("+ string(i) +"),...
plot(DM("+ string(i) +")(:,7),DM("+ string(i) +")(:,4),''ro*'',DM("+
string(i) +")(:,7),DM("+ string(i) +")(:,5),''o''),...
   ";
execstr(str1) ;
end


Paul

-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de
samaelkreutz Envoyé : vendredi 7 février 2014 23:40 À :
users@lists.scilab.org Objet : [Scilab-users] Loading multiple text files

Hello, I'm newbie in scilab... 

I have one folder
/Users/konstantina/Desktop/CHECK/export_5-20/export_5-20HZ_C*.txt

where *  takes the values= 1:1:5

I need open each text file and make a plot. So, I was thinking in something
like  

for i=1:1:4//
DM(i)=fscanfMat('export_5-20HZ_C(i).txt')
figure(i)
plot(DM(i)(:,7),DM(i)(:,4),'ro*',DM(i)(:,7),DM(i)(:,5),'o')
end

but is obvious that it doesn't work, hehehe.
Please, please any suggestions!!! Ill be very thankful

:)

Best wishes!!!




--
View this message in context:
http://mailinglists.scilab.org/Loading-multiple-text-files-tp4028528.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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant
parce que la protection avast! Antivirus est active.
http://www.avast.com

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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


Re: [Scilab-users] Loading multiple text files

2014-02-07 Thread Paul CARRICO
I haven't tested specifically your example, but I would use something like :

for i=1:1:4
str1 = "...
DM("+ string(i) +")=fscanfMat(''export_5-20HZ_C("+ string(i) +").txt''),...
figure("+ string(i) +"),...
plot(DM("+ string(i) +")(:,7),DM("+ string(i) +")(:,4),''ro*'',DM("+
string(i) +")(:,7),DM("+ string(i) +")(:,5),''o''),...
   ";
execstr(str1) ;
end


Paul

-Message d'origine-
De : users [mailto:users-boun...@lists.scilab.org] De la part de
samaelkreutz
Envoyé : vendredi 7 février 2014 23:40
À : users@lists.scilab.org
Objet : [Scilab-users] Loading multiple text files

Hello, I'm newbie in scilab... 

I have one folder
/Users/konstantina/Desktop/CHECK/export_5-20/export_5-20HZ_C*.txt

where *  takes the values= 1:1:5

I need open each text file and make a plot. So, I was thinking in something
like  

for i=1:1:4//
DM(i)=fscanfMat('export_5-20HZ_C(i).txt')
figure(i)
plot(DM(i)(:,7),DM(i)(:,4),'ro*',DM(i)(:,7),DM(i)(:,5),'o')
end

but is obvious that it doesn't work, hehehe.
Please, please any suggestions!!! Ill be very thankful

:)

Best wishes!!!




--
View this message in context:
http://mailinglists.scilab.org/Loading-multiple-text-files-tp4028528.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


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

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


Re: [Scilab-users] scilab memory usage

2014-01-05 Thread paul . carrico
Hi

have a look to "csvread" functions to read (very fast) txt/csv files even for 
huge file including million(s) of lines ...
.. but I've not figure out what you want to do exactly

Paul

- Mail original -
De: "Stephan Schreckenbach" 
À: users@lists.scilab.org
Envoyé: Samedi 4 Janvier 2014 23:31:28
Objet: [Scilab-users] scilab memory usage




Hi, 
I want to script a code that reads data from txt or csv files and does some 
calculations on them. In the future I might evaluate large data files, 
run calculation extensive parameter optimizations, do some loops with a high 
number of onedimensional calculations. 
Therefore I worry about speed and memory usage. 
I run WinXp with 3GB RAM, Intel Core 2Duo. 



Since scilab processes all data as variant, how much memory is required for 
each constant or variable, being string, integer or double? 
I still wonder if I should script via Excel VBA or scilab. 
I will store my results in Excel anyway and it might be therefore easier to use 
VBA. 
As I have read, scilab can use up to 2 GB RAM, VBA only 500MB. 
But, in VBA data types can be declared, saving some memory. 

Scilab can do multithreading, but not on Windows, which is what I use. 
VBA can't do it eighter. 
VBA might have a larger user community and knowledge Base, Scilab might be 
easier to script. 



I would like to start out with eighter scilab or VBA and then to stick to one 
of them due to the large amount of code 
and subscripts to write . 



So-what is your suggestions? 
Thanks very much in advance for your help! 



___
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] how to read huge ascii files

2013-12-30 Thread Paul CARRICO
Thanks Denis



‘sed’ ‘awk’ and ‘grep’ as well seem to be promising for this purpose (either in 
a batch file or directly within scilab)  … thanks for this advice



Paul



De : users [mailto:users-boun...@lists.scilab.org] De la part de CRETE Denis
Envoyé : dimanche 29 décembre 2013 23:49
À : International users mailing list for Scilab.
Objet : Re: [Scilab-users] how to read huge ascii files



Hello,

To read only parts of a huge ASCII file,I use an external filter based on ‘sed’ 
(or ‘gawk’) called by SciLab with ‘unix_g’... it is fast and very flexible.

HTH

Denis



De : users [mailto:users-boun...@lists.scilab.org] De la part de Paul CARRICO
Envoyé : dimanche 29 décembre 2013 23:25
À : users@lists.scilab.org
Objet : [Scilab-users] how to read huge ascii files



Dear All



How can I read and record huge ascii file when  mgetl leads to memory troubles 
(even using stacksize('max'))  ? it it possible to  split it ?



I’m speaking about an ascii file wherein there’s a lot of irrelevant 
comments/texts/blanks  etc. … ?



Thanks for any advice



Happy new year



Paul





  _


 <http://www.avast.com/> Image supprimée par l'expéditeur.

Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection Antivirus avast! <http://www.avast.com/>  est active.





---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com
<>___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] how to read huge ascii files

2013-12-29 Thread Paul CARRICO
Dear All



How can I read and record huge ascii file when  mgetl leads to memory
troubles (even using stacksize('max'))  ? it it possible to  split it ?



I'm speaking about an ascii file wherein there's a lot of irrelevant
comments/texts/blanks  etc. . ?



Thanks for any advice



Happy new year



Paul





---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Help with text files

2013-11-26 Thread Paul Carrico
Try basicaly …

phrase=mgetl(fd)

then you’ve an array of characters …



Paul







De : users [mailto:users-boun...@lists.scilab.org] De la part de Eduardo
Torrecillas
Envoyé : mardi 26 novembre 2013 19:14
À : International users mailing list for Scilab.
Objet : [Scilab-users] Help with text files



Hello all,

I currently have some text files and I would like to extract information
from them using Scilab.
I have done this before, using mopen and mgetl, for example.

Don't know why, but strangely in this case it is not working. I am using
Scilab 5.4.1 on Ubuntu (but Scilab 5.4.0 under Windows produced the same
result).

Please check the attached text file.

Simple code such as:

fd=mopen('scilab_example.txt','r')

phrase=mgetl(fd,1)

Produces:

phrase=ÿp

If i still try to use mgetl, next lines are always returned as empty.

Does anybody have any clue on whats happening?

Best regards,



--
Eduardo Torrecillas
AER-09



---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


  1   2   >