Re: [Scilab-users] Reading numericaldata from txt file containing headlines

2017-03-03 Thread Serge Steer

You can proceed as follow without any change in your file:

u=mopen("myfile","r");
header=mgetl(u,4)

data=mfscanf(-1,u,"%f %f\n")

Le 03/03/2017 à 13:09, Jens Simon Strom a écrit :

Hi,
with
x=read(file,-1,2)
I can read the data from a text file containing e. g.

1  2.12   First line of text file
2.12   3.2
3 2
4  2
5 2.
6 2
7 2
Last line empty

What can I do to read only the numbers from a text file like

Header 1 First line of text file
Header 2


1 2.12
2.12 3.2
3 2
4 2
5 2.
6 2
7 2
Last line empty

where the data start in the 5th line?

Regards, Jens



___
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] Bode of discret time transfer function.

2017-02-25 Thread Serge Steer

Le 25/02/2017 à 19:17, Pablo Fonovich a écrit :


Hi:

This is the first time i work with discrete time transfers functions 
and Scilab.


I want to use bode() for plotting the magnitud and phase response of 
the system, however, i don't understand how to set the frequencies to 
normalized values (-pi, pi).


This is what i'm doing:


s=poly(0,'s')
H=(s^(-2400))/(1-0.5*s^(-2400))
S=syslin('d',H)
bode(S)


i get a warning that frequencies beyond nyquist rate are ignored and 
the resulting plot is attached.



In the help, it says that bode parameter could include fmin and fmax 
in herz, but isn't a discrete system response limited to normalized 
frequencies? And to transform the normalized frecuency to herz the 
sample rate must be used, but i don't know how to pass it to the 
system or something.


S=syslin(dt,H) defines a dynamical system sampled. dt beeing the 
sampling period in second.

If you want the frequency uniis be in rd/s add "rad" as last input argument


Any hints would be appreciated.

Thanks



___
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 6.0.0, read()

2017-02-22 Thread Serge Steer

I got similar results under Linux :
Scilab-5.5.2: 0.03 s
Scilab-6.0.0: 5.13s

Serge
Le 22/02/2017 à 18:30, Stefan Du Rietz a écrit :
Here you are, Lester! A script that generates a comparatively small 
data file and then reads it is attached.


In a small laptop computer with Windows 10 and 32-bit versions of Scilab:

Scilab-5.5.2:

size(mat) = [1  7]
mat took 0.08 sec to read.
size(mat) = [1  7]

Scilab-6.0.0:

size(mat) = [1  7]
mat took 39.14 sec to read.
size(mat) = [1  7]

Regards
Stefan


On 2017-02-22 11:43, Lester Anderson wrote:

Haven't got as far as testing the functions, but just starting version
6 compared to 5.5.2 is slower; not sure what is going on. Testing on
Windows 8.1 (4 Gb RAM).

Do you have a test script to try, see if the issue can be reproduced?

Cheers
Lester

On 22 February 2017 at 10:15, Stefan Du Rietz  wrote:

Hello,
I got Scilab 6 to work in a Windows 10 laptop. However, my loading 
of data

with read() took almost half an hour.
From toc() and mprintf():
Loading of data took 26 min 23 sec

In Scilab 5.5.2 it took just over a second.
From toc() and mprintf():
Loading of data took 1.219 sec.

What happened?

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




___
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] Anonymous functions

2017-01-17 Thread Serge Steer

A partial solution should be
deff("y=f(x)","a="+sci2exp(a,0)+";y=a*x")

but it may cause numerical problem as a is formatted
Regards

Serge Steer
On 17/01/2017 08:23, Pierre Vuillemin wrote:

Hi all,

I am trying to reproduce the behaviour of anonymous function in Scilab 
(see the code in lambdaFun here: https://github.com/pivui/scilabTools).


At the moment, it works like in Matlab, for instance:

a = eye(3,3);
lambda 'f(x) = a*x' // the name of the lambda function will be f
a = rand(3,3)   // the value of 'a' is saved in the lambda 
function when it is created

f(ones(3,1))// gives [1,1,1]'

I would like to emulate the behaviour of lambda function of python as 
well. In that case, 'a' should change when the initial variable 
changes, for instance


a = 2
f = lambda : a
def fun():
  a = 4
  return f
a = 3
f()   // should return 3
fun() // should return 3 -> it does not take the variable 'a' in the 
function namespace


I need to remember where the value or a is stored, I don't know if it 
is possible?


Regards,

Pierre
___
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] Redirecting the console output into a file

2017-01-14 Thread Serge Steer

Sorry , forgot my answer, I read your mail too quickly...
Serge
On 14/01/2017 15:50, Samuel Gougeon wrote:

Hello,

I am wondering if there is any way to temporarily redirect the console 
output into a file.
I mean, not copying the stream as diary() does, but getting in a file 
the contents that are usually displayed, without displaying them.


I tried to change %io(2) with the id of a file opened with mopen(). 
Even when unprotecting %io with predef("clear") before changing 
%io(2), it does not work.


The best i did up to now is using diary, and then using clc(n) to 
clear the displayed contents.

But it is an awful (and slow) solution.

Any hint would be appreciated
Regards
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


Re: [Scilab-users] Redirecting the console output into a file

2017-01-14 Thread Serge Steer

You can use the diary function...
Serge


On 14/01/2017 15:50, Samuel Gougeon wrote:

Hello,

I am wondering if there is any way to temporarily redirect the console 
output into a file.
I mean, not copying the stream as diary() does, but getting in a file 
the contents that are usually displayed, without displaying them.


I tried to change %io(2) with the id of a file opened with mopen(). 
Even when unprotecting %io with predef("clear") before changing 
%io(2), it does not work.


The best i did up to now is using diary, and then using clc(n) to 
clear the displayed contents.

But it is an awful (and slow) solution.

Any hint would be appreciated
Regards
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


Re: [Scilab-users] Influencing the automatic rotation_angles setting in advance

2016-12-10 Thread Serge Steer

Le 10/12/2016 à 21:00, Jens Simon Strom a écrit :

Hallo Scilab experts,
During execution of  plot3d, param3d, surf, etc. Scilab 
*automatically* chooses the axes property *rotation_angles*. Is there 
a way to influence this automatic? I do not mean ca=gca(); 
ca.rotation_angles=[ang1 ang2].  The setting should be positioned in 
the script***before* the plot command und should be valid for further 
plots.


This question is in context with the thread  'untwinkle  a sequence of 
graphics'.  Without setting ca.rotation_angles=[a1 a2] after the 
param3d  there is no twinkle. If I set the appropriate aspect - 
twinkling occurs again.
You can call  drawlater() just before the sequence plot3d(...); 
ca.rotation_angle=

this way the intermediate graphics will not be displayed
and call drawnow() just after to show the final graphic


I have not been able to reduce this to a a minimal example. Perhaps my 
enquiry suffices.


Kind regards
Jens


___
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] more polarplots in one coordinate system

2016-12-06 Thread Serge Steer

Le 06/12/2016 à 14:55, Maxi041291 a écrit :

Hello again,

how to plot a large legend, which is next to the polarplot?

If I use legend_location="in_lower_right", it is hiding my plot.
If I use  -"- out_lower_right, i can't see it anymore [or just the line of
the box]
if you put the legend out of the axes box uou may have to enlarge the 
corresponding margin

ax=gca();
ax.margin(4)=0.25, //for the lower margin


Thank you
Maxi



--
View this message in context: 
http://mailinglists.scilab.org/more-polarplots-in-one-coordinate-system-tp4035127p4035183.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] more polarplots in one coordinate system

2016-11-30 Thread Serge Steer
Please find attached a revision of the polarplot1 function wich allows 
to request a full 4 quadrants polar plot.


and below an example with arrowed lines

phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
colors=[5,2,3,1,4,9];
clf
for k=1:size(phase,"*")-1
polarplot1(phase(k:k+1),magnitude(k:k+1),colors(k),%t)
e=gce();e.children(1).polyline_style=4;  //arrowed style polylines
end
polarplot1(allphase,allmagnitude,colors(6),%t)
e=gce();e.children(1).polyline_style=4;   //arrowed style polylines

or

clf;
phi=[];mag=[];
for k=1:size(phase,"*")-1
  phi=[phi phase(k:k+1)];
  mag=[mag magnitude(k:k+1)];
end
phi=[phi allphase];
mag=[mag allmagnitude];
polarplot1(phi,mag,colors,%t)
e=gce();e.children(1:$-1).polyline_style=4;


Le 30/11/2016 à 08:27, Maxi041291 a écrit :

Hello again,

Its just shown the part of the polarplot, which is used, but i would like to
see the plot from 0° to 360°.
how do i set the angle axis from 0° to 360° every time?

Thank you for helping :)





--
View this message in context: 
http://mailinglists.scilab.org/more-polarplots-in-one-coordinate-system-tp4035127p4035146.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
// Copyright (C) 2012 - 2016 - Scilab Enterprises
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// This file was originally licensed under the terms of the CeCILL v2.1,
// and continues to be available under such terms.
// For more information, see the COPYING file which you should have received
// along with this program.

function polarplot1(theta,rho,style,full)
[lhs,rhs]=argn(0)

if rhs<=0 then
theta=0:.01:2*%pi;
rho=sin(2*theta).*cos(2*theta)
clf();
polarplot(theta,rho)
return
end
if size(theta,1)==1 then
theta=theta(:),
end
if size(rho,1)==1 then
rho=rho(:),
end
if rhs<4 then full=%f;end
rm=max(abs(rho))
x=rho.*cos(theta)
y=rho.*sin(theta)
if full then
  xmax=max(abs(x));
  xmin=-xmax
  ymax=max(abs(y));
  ymin=-ymax
else
 xmin=min(x);
 xmax=max(x);
 ymin=min(y);
 ymax=max(y);
end

drawlater()
a=gca();
if a.tag=="polarplot" then 
  //clear grid
  delete(a.user_data.grid);
  bnds=a.user_data.bounds
  xmin=min(bnds(1),xmin)
  xmax=max(bnds(2),xmax)
  ymin=min(bnds(3),ymin)
  ymax=max(bnds(4),ymax)
  rm=max(bnds(5),rm)
  c=a.children
  g=polargrid(xmin,xmax,ymin,ymax,rm)
  //put the grid on the background
  for k=1:size(c,'*')
swap_handles(c(k),g)
  end
else
  polargrid(xmin,xmax,ymin,ymax,rm)
end
C=[]
for k=1:size(theta,2)
  xpoly(x(:,k),y(:,k))
  e=gce();
  e.foreground=style(k)
  C=[e C];
end
glue(C)
drawnow()
endfunction

function G=polargrid(xmin,xmax,ymin,ymax,rm)
// Some default values:
  Amin=0 // starting angle for the frame
  dA=360 // span of the angular frame
  nn=4// number of quadrants to be drawn
  
  // Angle at which Radial labels will be displayed
  A=round(atan((ymin+ymax)/2,(xmin+xmax)/2)/%pi*180/45)*45;
  dx=-0.5, dy=-0.5  // H & V shifts in string-width and string-height units
  L=(xmax-xmin)*1.07;
  H=(ymax-ymin)*1.07;
  
  //determine Qudrants to be drawn
  Q=[%T %T %T %T];
  e=rm/500;

  if xmin<-e then
xmin=-rm;
  else
xmin=0; Q([2 3])=%F;
  end

  if xmax>e then
xmax= rm;
  else
xmax=0; Q([1 4])=%F;
  end

  if ymin<-e then
ymin=-rm;
  else
ymin=0; Q([3 4])=%F;
  end

  if ymax>e then
ymax= rm;
  else
ymax=0; Q([1 2])=%F;
  end
  L=(xmax-xmin)*1.1; if L==0, L=2*rm*1.1; end
  H=(ymax-ymin)*1.1; if H==0, H=2*rm*1.1; end
  x0=(xmin+xmax)/2; y0=(ymin+ymax)/2;
  rect=[x0-L/2 y0-H/2 x0+L/2 y0+H/2]

  // Special case: data aligned on the x or y axis
  if Q==[%F %F %F %F],
if (ymax-ymin)<2*e, // on x axis
  if xmin<-e then
Q([2 3])=%T
  end
  if xmax> e  then
Q([1 4])=%T
  end
else  // on y axis
  if ymin<-e  then
Q([3 4])=%T
  end
  if ymax> e then
Q([1 2])=%T
  end
end
  end

  n=find(Q);   // id numbers of quadrants to be drawn
  nn=length(n) // number of quadrants to be drawn
  Amin=(n(1)-1)*90

  select nn
  case 1,
dA=90;
if n==1, A=90, dx=-1.1, dy=-0.5
elseif n==2, A=90, dx=0.2, dy=-0.5
elseif n==3, A=270, dx=0.2, dy=-0.5
else A=270, dx=-1.1, dy=-0.5
end
  case 2
dA=180;
if n(1)==1
  if n(2)==2, //A=90, dx=0.1, dy=-0.5
  else Amin=-90, 

Re: [Scilab-users] more polarplots in one coordinate system

2016-11-28 Thread Serge Steer
Please find attached a new polarplot1 function which is able to do what 
you want (some refinements may have to be done)


Example (sequences of polar plots)

phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
colors=[5,2,3,1,4,9];
clf
for k=1:size(phase,"*")-1
  polarplot1(phase(k:k+1),magnitude(k:k+1),colors(k))
end
polarplot1(allphase,allmagnitude,colors(6))

Example (many plots with a simple call)

clf;
phi=[];mag=[];
for k=1:size(phase,"*")-1
  phi=[phi phase(k:k+1)];
  mag=[mag magnitude(k:k+1)];
end
phi=[phi allphase];
mag=[mag allmagnitude];
polarplot1(phi,mag,colors)



Le 28/11/2016 à 16:01, Maxi041291 a écrit :

Thank you for trying to help, but i think i didnt describe my Problem well
enough.
Normally there should be arrows in the plot, but i dont think this is
possible in scilab.

But here a Piece of my original code in scilab:


clear;
clc;
phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
//This is how it works, but just for a defined length of the vectors
clf(1);
polarplot([phase(1:2) phase(2:3) phase(3:4) phase(4:5) phase(5:6)
allphase],[magnitude(1:2) magnitude(2:3) magnitude(3:4) magnitude(4:5)
magnitude(5:6) allmagnitude],[5,2,3,1,4,9]);

//This is the way it doesnt work
clf(2);
polarplot(phase,magnitude,[5,2]);
polarplot(allphase,allmagnitude,[1,2]);




Because the length of the vectors (Magnitude and Phase) is not fixed in my
original code, i think i cant define the polarplot like its done in the
first example.
So i would like to do it like in the second example, but that doesn´t work,
because i get a new axis for each datapoint
  





--
View this message in context: 
http://mailinglists.scilab.org/more-polarplots-in-one-coordinate-system-tp4035127p4035130.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
// Copyright (C) 2012 - 2016 - Scilab Enterprises
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// This file was originally licensed under the terms of the CeCILL v2.1,
// and continues to be available under such terms.
// For more information, see the COPYING file which you should have received
// along with this program.

function polarplot1(theta,rho,style)
[lhs,rhs]=argn(0)

if rhs<=0 then
theta=0:.01:2*%pi;
rho=sin(2*theta).*cos(2*theta)
clf();
polarplot(theta,rho)
return
end
if size(theta,1)==1 then
theta=theta(:),
end
if size(rho,1)==1 then
rho=rho(:),
end
 
rm=max(abs(rho))
x=rho.*cos(theta)
y=rho.*sin(theta)
xmin=min(x);
xmax=max(x);
ymin=min(y);
ymax=max(y);

drawlater()
a=gca();
if a.tag=="polarplot" then 
  //clear grid
  delete(a.user_data.grid);
  bnds=a.user_data.bounds
  xmin=min(bnds(1),xmin)
  xmax=max(bnds(2),xmax)
  ymin=min(bnds(3),ymin)
  ymax=max(bnds(4),ymax)
  rm=max(bnds(5),rm)
end
   
  
  
   
polargrid(xmin,xmax,ymin,ymax,rm)
for k=1:size(theta,2)
  xpoly(x(:,k),y(:,k))
  e=gce();
  e.foreground=style(k)
end
drawnow()
endfunction

function polargrid(xmin,xmax,ymin,ymax,rm)
// Some default values:
  Amin=0 // starting angle for the frame
  dA=360 // span of the angular frame
  nn=4// number of quadrants to be drawn
  
  // Angle at which Radial labels will be displayed
  A=round(atan((ymin+ymax)/2,(xmin+xmax)/2)/%pi*180/45)*45;
  dx=-0.5, dy=-0.5  // H & V shifts in string-width and string-height units
  L=(xmax-xmin)*1.07;
  H=(ymax-ymin)*1.07;
  
  //determine Qudrants to be drawn
  Q=[%T %T %T %T];
  e=rm/500;

  if xmin<-e then
xmin=-rm;
  else
xmin=0; Q([2 3])=%F;
  end

  if xmax>e then
xmax= rm;
  else
xmax=0; Q([1 4])=%F;
  end

  if ymin<-e then
ymin=-rm;
  else
ymin=0; Q([3 4])=%F;
  end

  if ymax>e then
ymax= rm;
  else
ymax=0; Q([1 2])=%F;
  end

  L=(xmax-xmin)*1.1; if L==0, L=2*rm*1.1; end
  H=(ymax-ymin)*1.1; if H==0, H=2*rm*1.1; end
  x0=(xmin+xmax)/2; y0=(ymin+ymax)/2;
  rect=[x0-L/2 y0-H/2 x0+L/2 y0+H/2]

  // Special case: data aligned on the x or y axis
  if Q==[%F %F %F %F],
if (ymax-ymin)<2*e, // on x axis
  if xmin<-e then
Q([2 3])=%T
  end
  if xmax> e  then
Q([1 4])=%T
  end
else  // on y axis
  if ymin<-e  then
Q([3 4])=%T
  end
  if ymax> e then
Q([1 2])=%T
  end
end
  end

  n=find(Q);   // id numbers of quadrants to be drawn
  

Re: [Scilab-users] lack of simplification for rational

2016-11-23 Thread Serge Steer
First of all if you compute the rational fraction numerator or 
denominator from their roots (and if they are complex conjugate) the 
result is a complex polynomial even if the imaginary part is not shown.


Second: the simplification of numerical rational fraction is a very 
difficult problem. As Tim said  the roots computed by numerical 
algorithm cannot be use for that purpose.

Just try:
p=poly(ones(1,n),"x","c");
r=roots(p)
plot(real(r)-1,imag(r),"+")
You will see the roots on a circle which radius is of order %eps^(1/n) !
It is not a bug just a consequence of the numerical computations.

The simplication algorithm present in Scilab tryes to find reasonable 
simplification based on the bezout equation error. But it has only be 
written for the real case.


The bug fixes Samuel pointed to you  allow simplification for complex 
polynomials having zero  imaginary parts.

Serge
Le 23/11/2016 à 19:37, philippe a écrit :

Hi,

I  have a problem  to simplify automatically rational with an 
imaginary part. In my case  I only manipulate polynomials with real 
coefficients but some imaginary part arise due to rounding errors. See 
this example :


-->X=poly(0,'x');

-->A=(X-1)^2;

-->B=(X-1)*(X-2);

-->R=A/B// = (X-1)/(X-2)
 R  =

  - 1 + x
-
  - 2 + x

-->A=clean(A+%eps*(1+%i))//  add a rounding error
 A  =

Partie réelle


  2
1 - 2x + x
Partie imaginaire


0

-->R=A/B// = no simplifications
 R  =

2
1 - 2x +  1x
   --
  2
2 - 3x + x


I can't simplify R, even using simp(R), I've found some work around 
applying clean  to numerator/denominator coefficients TWICE (I don't 
known why twice?!?!?)  :


-->R=poly(clean(coeff(numer(R))),'x')/poly(clean(coeff(denom(R))),'x')
 R  =

 2
  - 2 + x + x
-
 2
  - 6 + x + x

-->R=poly(clean(coeff(numer(R))),'x')/poly(clean(coeff(denom(R))),'x')
 R  =

2 + x
-
6 + x

but of course this doesn't work  for polynomials with complex 
coefficients like :



-->(X+%i)/(X^2+1) // = 1/(X-%i)
 ans  =


   i +  1x
   
 2
1 + x

I would like to find a solution for all polynomials with real/complex 
coefficients , any idea ?


Philippe

___
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] using csvRead

2016-10-14 Thread Serge Steer

you can use the mfscanf function:

u=mopen("myfile","r");
h=mfscanf(1,u,"%s\n");
r=mfscanf(-1,u,"%d.%d.%d, %d:%d:%f, %f, %f\n");
mclose(u)

Serge Steer

Le 14/10/2016 à 00:08, Philipp Mühlmann a écrit :

Dear Scilab users,

having a data file (*.cvs) containg following format:


HEADER-Line
dd.mm., HH:MM:SS.MS <http://SS.MS>, value01, value02

dd = day
mm = month
 = year

HH = hour
MM = minute
SS = second
Ms = milli second

ValueXY = numerical value

Is it possible to use cvsRead in such a way to define the separator 
beeing ',' and ':' at the same time?


Background:

desired Matrix after reading the file is

M = [dd mm  HH MM SS MS value1 value2]


Thank you,
Philipp


--
In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.

There we have the salad.


___
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 Serge Steer
If you use optim you can  set the ind retured arg to -1 in the cost 
function to say that the function cannot be evaluated at this point.


Serge

Le 06/10/2016 à 10:51, paul.carr...@free.fr a écrit :


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


Re: [Scilab-users] is vectorization possible

2016-09-27 Thread Serge Steer

Le 27/09/2016 à 09:08, paul.carr...@free.fr a écrit :

Hi All

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

if a is a vector, it is quite straight forward: sum(matrix(a,w,-1),1).'
k=100;a=rand(k,1);w=5;n=k/w;
tmp = zeros(n,1);
for i = 1 : n
tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:));
end
tmp-sum(sum(matrix(a,w,n,-1),3),1).'


If a is matrix it is more tricky: sum(sum(matrix(a,w,n,-1),3),1).'
k=100;a=rand(k,4);w=5;n=k/w;

tmp = zeros(n,1);
for i = 1 : n
tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:));
end
tmp-sum(sum(matrix(a,w,n,-1),3),1).'


Serge


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



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


Re: [Scilab-users] csvread different separator

2016-05-24 Thread Serge Steer

Le 23/05/2016 23:15, Florian Winter a écrit :

Hello
I'm trying to write a function that reads data from a single file. It 
is a rather large file so I wanted to use the csvread function because 
it is faster than opening the file and then using scanf.
I am surprised by the fact csvread is faster than mfscanf. mfscanf 
directly call C code while csvread is xritten in Scilab...


The problem is, that my file is not a real csv file. It has different 
number of spaces in between every data entry.

It looks like this:

1 2  3   4   5 6 7   8
the spaces between each entry is the same in every row so between 1 
and 2 there is a single space, between 2 and 3 there are two spaces, 
between 3-4 and 4-5 three spaces, 5-6 one, 6-7 one and 7-8 three again.



Is there a faster way than opening the file and using a scanf?

Thank you!
Florian


___
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 6.0 beta, command line history and freezes

2016-04-28 Thread Serge Steer

Hello,
I just tried  under Suse 13.2 and it seems to work as expected.

Serge


Le 28/04/2016 10:59, antoine.monmayr...@laas.fr a écrit :

Hi everyone,

I think I found a bug (regression) in the current beta and I wonder 
whether it is related to my own setup (os, config, ...) or whether 
it's more general.
Is anyone here routinely using the current beta in command line mode 
(ie "scilab -nw" or "scilab-cli") ?
If yes, did you observe anything weird when navigating the command 
history using the up and down arrows?
For me, it freezes scilab for several minutes and does not echo the 
previous commands properly (observed on several linux 64bits 
computers), see http://bugzilla.scilab.org/show_bug.cgi?id=14535 .


Is anyone experiencing the same issue?
As anyone any clue on how to avoid it for the time being (apart from 
ripping off the up/dow arrows from my keyboard)?


Cheers,

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


Re: [Scilab-users] "Smoothing" very localised discontinuities in (scilab: to exclusive) (scilab: to exclusive) curves.

2016-04-04 Thread Serge Steer

Le 04/04/2016 20:38, scilab.20.browse...@xoxy.net a écrit :

Serge,



sgolay filter
(http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter;>http://en.wikipedia.org/wiki/Savitzky-Golay_filter)otherwise
the loess regression
(http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-nonparametric-regression.pdf)

That pdf does not seem to be available to me? (The requested URL was not found 
on this server)

You are right the URL is no more active
You can find it here
https://socserv.socsci.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-Nonparametric-Regression.pdf 


may be tried .

Both methods and others  like medianfilter , sdfilter, ... are available
in the CWA scilab module...

'scuse my ignorance of these things; but it the "CWA scilab module" available 
as an ATOM? (If so, in which category?)

Data Analysis and  statistics
https://atoms.scilab.org/toolboxes/CWA

Or should I be looking somewhere else?




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


Re: [Scilab-users] "Smoothing" very localised discontinuities in (scilab: to exclusive) curves.

2016-04-04 Thread Serge Steer
If your data are regulary sampled along the y axis you can use the 
sgolay filter 
(http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter;>http://en.wikipedia.org/wiki/Savitzky-Golay_filter)otherwise 
the loess regression 
(http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-nonparametric-regression.pdf) 
may be tried .


Both methods and others  like medianfilter , sdfilter, ... are available 
in the CWA scilab module...


Serge Steer

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


Re: [Scilab-users] The value of a uicontrol within its callback?

2016-03-27 Thread Serge Steer

Inside the callback, the gcbo variable contains the handle on the uicontrol
so gcbo.value is probably what you are looking for
Serge Steer

Le 27/03/2016 16:21, scilab.20.browse...@xoxy.net a écrit :

How do you access the value of a uicontrol (spinner or slider) from within its 
callback code?

Thanks, Buk


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth



___
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] Phase shift and step size in XCOS - electrical

2016-03-24 Thread Serge Steer

Le 23/03/2016 22:38, laftek a écrit :

Thank you for such quick response.

So far i found that there are 3 ways to get phase shift. But I am not sure
if these are right solutions.

*1.)*

It´s the one I mentioned. I tried to reconstruct fourier block from MATLAB :
http://postimg.org/image/l764cdb1v/ 

But there is atan2 block which i cant replace in xcos (undefined variable :
atan2). So I found alternative to atan2(x,y) - atan(y/x) but there is
singularity problem :
http://postimg.org/image/4vg07lm91/ 

Any idea ?

The Scilab equivalent of Matlab atan2(x,y) is atan(x,y)
Serge


*2.)*

Very simple solution.



I succesfully got angle :
http://postimg.org/image/mknvh4u3l/ 

but if I am trying to implement rad to degree convertor block I am getting
the same error : Singularity in a block :
http://postimg.org/image/yqpfn5j31/ 

Do you know some workaround ?

*3.)*

The last one : in this case I dont know how to transform it to xcos (zero
crossing blocks) and I need to know what quadrant the angle is in.
http://postimg.org/image/g6b851s2j/ 

quadrants :



I know these are simple methods but it is all I got so far. Let me know if
there is something wrong or some other way how to get angle between two
signals.

I would greatly appreciate any help. Thanks in advance.





--
View this message in context: 
http://mailinglists.scilab.org/Phase-shift-and-step-size-in-XCOS-electrical-tp4033797p4033842.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] convert Matlab functions to Scilab

2016-03-15 Thread Serge Steer

Converted from Octave codes, not fully tested
Serge Steer

Le 11/03/2016 21:50, Philipp Mühlmann a écrit :

Just a shot in the blue...

does anybody successfully converted the Matlab function

maketform.m

into Scilab?


Best regards,
Philipp


--
There we have the salad.


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




tform.tar.gz
Description: GNU Zip compressed data
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Model ID of First order delay and Dead Time Process

2016-03-12 Thread Serge Steer

You made a mistake because the response you compute with
rep=flts(u,tf2ss(h)); k=find(rep<>0,1)
is not exactly a step response because the step does not occur at the 
first sample


If you use
H=time_id(10,u,rep)
to identify the response you vill got a batter result

An other an probably better solution is to extract the delay before 
starting the identification:
k=find(rep<>0,1) //here the threshold has to be improved in case of 
noisy signal

H=time_id(1,"step",rep(k:$))

Serge
Le 11/03/2016 18:44, noguchi a écrit :

Dear Mr.Serge,


Thank you for your advise. I tried to use time_ID.
Please look at the following Scinote:

z=poly(0,'z');
h=(0.07/(z-0.934))*(1/z^10)
u=zeros(1,100);
for i=6:1:100
 u(1,i)=1;
end
t=1:1:100;
rep=flts(u,tf2ss(h));
plot(t,rep,t,u)
H=time_id(10,'step',rep)
rep=flts(u,tf2ss(H));
plot(t,rep,'.r')

There is a big difference between the original model equation and Identified
model equation.
The responsed curves are also different each other.
Are there any good command so that I can obtain parameters for first order
time delay constant and its gain and dead time?

Thank you foryour help.


Y. Noguchi




--
View this message in context: 
http://mailinglists.scilab.org/Model-ID-of-First-order-delay-and-Dead-Time-Process-tp4033659p4033692.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] Problem graypolarplot

2016-03-11 Thread Serge Steer
Sorry the file attached in my previous mail contains a forgotten pause 
instruction


Le 11/03/2016 09:52, SCHULZ Wolfgang a écrit :

Hello,
I have problems using the options of graypolarplot
The following basic function is working:
graypolarplot(theta,rho,Gain_plot')

But if I want to use some options I get an error message. The following 
examples produce error messages:
graypolarplot(theta,rho,Gain_plot',strf="030",rect=[-20,-20,20,20])
graypolarplot(theta,rho,Gain_plot',"020",[-500,-500,500,500])
graypolarplot(theta,rho,Gain_plot',"030")


How to use those examples?

These was old options. With current Scilab version if you want to change 
the data bounds (rect) you can modify the data_bounds property of the axes


graypolarplot(theta,rho,Gain_plot')
ax=gca(); //get the handle on the currect axes
ax.data_bounds=[-20 -20;20 20].


Another question would be - is it possible to have 0° in the direction of the 
positive y-axis (North) and maybe the direction of the angle clockwise?

Please find attached a ffunction which realizes what you want.

Thanks for your help
Wolfgang
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) Samuel GOUGEON - 2013 : vectorization, code style
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt


function graypolarplot(theta,rho,z,varargin)
function c=Cos(x),c=cos(-x+%pi/2);endfunction
function s=Sin(x),s=sin(-x+%pi/2);endfunction

[lhs,rhs] = argn(0)
if rhs<=0 then
rho = 1:0.2:4
theta = (0:0.02:1)*2*%pi
z = 30+round(theta'*(1+rho.^2))
clf()
f = gcf()
f.color_map = hotcolormap(128)
f.background= 128
a = gca()
a.background = 128
a.foreground = 1
graypolarplot(theta,rho,z)
return
end

if rhs<3 then
error(msprintf(gettext("%s: Wrong number of input argument(s): At least 
%d expected.\n"), "graypolarplot", 3));
end

R = max(rho)
nv = size(varargin)
if nv>=1
strf = varargin(2)
else
strf = "030"
end
if nv>=2
rect = varargin(4)
else
rect = [-R -R R R]*1.1
end

// drawlater
fig = gcf();
immediate_drawing = fig.immediate_drawing;
fig.immediate_drawing = "off";

axes = gca();
axes.data_bounds = [rect(1), rect(2); rect(3), rect(4)];
axes.clip_state = "clipgrf";

drawGrayplot(theta,rho,z);

objectList = gce(); // get all the created objects to glue them at the end.

axes.isoview = "on";
axes.box = "off";
axes.axes_visible = ["off","off","off"];
axes.x_label.text = "";
axes.y_label.text = "";
axes.z_label.text = "";

step = R/5
r  = step;
dr = 0.02*r;
for k = 1:4
xarc(-r, r, 2*r, 2*r, 0, 360*64)
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 3;
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), 
string(round(10*r)/10))
objectList($ + 1) = gce();
r=r+step
end
xarc(-r,r,2*r,2*r,0,360*64)
objectList($ + 1) = gce();
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), string(round(10*r)/10))
objectList($ + 1) = gce();

rect = xstringl(0,0,"360");
w = rect(3);
h = rect(4);
r = R*1.05
for k = 0:11
xsegs([0 ; R*Cos(k*(%pi/6))],[0 ; R*Sin(k*(%pi/6))])
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 4;
xstring((r+w/2)*Cos(k*(%pi/6))-w/2, 
(r+h/2)*Sin(k*(%pi/6))-h/2,string(k*30))
objectList($ + 1) = gce();
end

// glue all the created objects
glue(objectList);

// drawnow
fig.immediate_drawing = immediate_drawing;

endfunction
// ---

function [x,y] = polar2Cart(rho, theta)
x = rho * Cos(theta);
y = rho * Sin(theta);
endfunction
// ---

function [nbDecomp] = computeNeededDecompos(theta)
// Compute the needed decomposition for each patch

// minimal decompostion for each ring
nbFactesPerRingMin = 512;

nbDecomp = ceil(nbFactesPerRingMin / size(theta, "*"));

endfunction
// ---
function drawGrayplot(theta, rho, z)
// draw only the colored part of the grayplot

// the aim of the function is to draw a set of curved facets
// In previous versions, it used arcs to perform this.
// However, since arcs are drawn from the origin to the outside
// there were overlapping and cause Z fighting 

Re: [Scilab-users] Problem graypolarplot

2016-03-11 Thread Serge Steer

Le 11/03/2016 09:52, SCHULZ Wolfgang a écrit :

Hello,
I have problems using the options of graypolarplot
The following basic function is working:
graypolarplot(theta,rho,Gain_plot')

But if I want to use some options I get an error message. The following 
examples produce error messages:
graypolarplot(theta,rho,Gain_plot',strf="030",rect=[-20,-20,20,20])
graypolarplot(theta,rho,Gain_plot',"020",[-500,-500,500,500])
graypolarplot(theta,rho,Gain_plot',"030")


How to use those examples?

These was old options. With current Scilab version if you want to change 
the data bounds (rect) you can modify the data_bounds property of the axes


graypolarplot(theta,rho,Gain_plot')
ax=gca(); //get the handle on the currect axes
ax.data_bounds=[-20 -20;20 20].


Another question would be - is it possible to have 0° in the direction of the 
positive y-axis (North) and maybe the direction of the angle clockwise?

Please find attached a ffunction which realizes what you want.

Thanks for your help
Wolfgang
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) Samuel GOUGEON - 2013 : vectorization, code style
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt


function graypolarplot(theta,rho,z,varargin)
function c=Cos(x),c=cos(-x+%pi/2);endfunction
function s=Sin(x),s=sin(-x+%pi/2);endfunction

[lhs,rhs] = argn(0)
if rhs<=0 then
rho = 1:0.2:4
theta = (0:0.02:1)*2*%pi
z = 30+round(theta'*(1+rho.^2))
clf()
f = gcf()
f.color_map = hotcolormap(128)
f.background= 128
a = gca()
a.background = 128
a.foreground = 1
graypolarplot(theta,rho,z)
return
end

if rhs<3 then
error(msprintf(gettext("%s: Wrong number of input argument(s): At least 
%d expected.\n"), "graypolarplot", 3));
end

pause
R = max(rho)
nv = size(varargin)
if nv>=1
strf = varargin(2)
else
strf = "030"
end
if nv>=2
rect = varargin(4)
else
rect = [-R -R R R]*1.1
end

// drawlater
fig = gcf();
immediate_drawing = fig.immediate_drawing;
fig.immediate_drawing = "off";

axes = gca();
axes.data_bounds = [rect(1), rect(2); rect(3), rect(4)];
axes.clip_state = "clipgrf";

drawGrayplot(theta,rho,z);

objectList = gce(); // get all the created objects to glue them at the end.

axes.isoview = "on";
axes.box = "off";
axes.axes_visible = ["off","off","off"];
axes.x_label.text = "";
axes.y_label.text = "";
axes.z_label.text = "";

step = R/5
r  = step;
dr = 0.02*r;
for k = 1:4
xarc(-r, r, 2*r, 2*r, 0, 360*64)
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 3;
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), 
string(round(10*r)/10))
objectList($ + 1) = gce();
r=r+step
end
xarc(-r,r,2*r,2*r,0,360*64)
objectList($ + 1) = gce();
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), string(round(10*r)/10))
objectList($ + 1) = gce();

rect = xstringl(0,0,"360");
w = rect(3);
h = rect(4);
r = R*1.05
for k = 0:11
xsegs([0 ; R*Cos(k*(%pi/6))],[0 ; R*Sin(k*(%pi/6))])
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 4;
xstring((r+w/2)*Cos(k*(%pi/6))-w/2, 
(r+h/2)*Sin(k*(%pi/6))-h/2,string(k*30))
objectList($ + 1) = gce();
end

// glue all the created objects
glue(objectList);

// drawnow
fig.immediate_drawing = immediate_drawing;

endfunction
// ---

function [x,y] = polar2Cart(rho, theta)
x = rho * Cos(theta);
y = rho * Sin(theta);
endfunction
// ---

function [nbDecomp] = computeNeededDecompos(theta)
// Compute the needed decomposition for each patch

// minimal decompostion for each ring
nbFactesPerRingMin = 512;

nbDecomp = ceil(nbFactesPerRingMin / size(theta, "*"));

endfunction
// ---
function drawGrayplot(theta, rho, z)
// draw only the colored part of the grayplot

// the aim of the function is to draw a set of curved facets
// In previous versions, it used arcs to perform this.
// However, since arcs are drawn from the origin to the outside
// there were overlapping and cause Z fighting in 3D.
// Consequenlty we now decompose each curved facet into a set of 

Re: [Scilab-users] Model ID of First order delay and Dead Time Process

2016-03-09 Thread Serge Steer

Give a look to the io delay atoms module it may correspond to your whish.
Serge Steer


Le 09/03/2016 16:12, noguchi a écrit :

Hello,


May I ask your help?

1. How can I specify time delay for my transfer function in scilab. I found
it in matlab, but I failed to find it in SCilab.

2. Model ID
I would like to identify first or second order transfer function + dead time
from step test data (SISO).
If it is required to identify the other models, such as SS or ARX. It is
fine. Then, I would like to convert the model to transfer functioin + dead
time model.

Thanks.


Y. Noguchi



--
View this message in context: 
http://mailinglists.scilab.org/Model-ID-of-First-order-delay-and-Dead-Time-Process-tp4033659.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] Matrix: mix string and float

2016-03-04 Thread Serge Steer

example
M1=(1:15)';M2="foo"+string(M1);M3=sin(M1/10);
M=tlist("cblock",M1,M2,M3)

M(1:2,:)
M(:,1) //the result is a standard array of numbers
M(:,2) //the result is a standard array of strings

This kind of data structure can be obtained directly reading a data file 
with mfscanf

with the attached file
u=mopen("foo1")
M=mfscanf(-1,u,"%d %s %f\n")
mclose(u)


One can also use the cell array
M=cell(1,3);
M.entries(1)=M1;
M.entries(2)=M2;
M.entries(3)=M3;

This solution will be more simple under Scilab 6
M1=(1:15)';M2="foo"+string(M1);M3=sin(M1/10);
 M={M1,M2,M3}
M{:,1}//the result is a standard array of numbers
Le 04/03/2016 14:45, anna78 a écrit :

dear all,

I have 13 column vectors: M1, M2,  M13.
One is an integer /%d) vector, two are string (%s) vectors, the others are
double (%f).

I would like to build the matrix M=[M1 M2 M3... M13], but it looks like not
working.

Is it possible to build a matrix with different element types?

thanks
Anna



--
View this message in context: 
http://mailinglists.scilab.org/Matrix-mix-string-and-float-tp4033620.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



1 a  0.2
2 b  -0.5
3 c 33
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] bug in function iir ?

2016-02-26 Thread Serge Steer

Le 25/02/2016 18:10, grivet a écrit :

Le 24/02/2016 21:40, Serge Steer a écrit :

Le 24/02/2016 11:30, grivet a écrit :
I appreciate your help; however, neither suggestion works: I still 
get the same error message.

The similar line
[frq,repf]=repfreq(hz,0.01,0.49);
has no problem

You are right the problem is exactly for the frequency 0.5 besause
exp(2*%pi*%i*0.5) -> - 1. + 1.225D-16i
and hz.num has 2 zeros  very near  -1

I checked the hz value with Matlab, the results are the same. So it 
seems that hz is ok. So it is probabily a probleme due to floating point 
computations procucing a zero value instead of a very small one.


Serge
please can you save the hz value using the Scilab save function and 
send the file?

Serge



Voila le code:
//filtre Butterworth
Order   = 2; // The order of the filter
Fs  = 1000; // The sampling frequency
Fcutoff = 40;   // The cutoff frequency

// We design a low pass Butterworth filter
hz = iir(Order,'lp','butt',Fcutoff/Fs/2,[0.1 0.1]);

// We compute the frequency response of the filter
[frq,repf]=repfreq(hz,0,0.5);
[db_repf, phi_repf] = dbphi(repf);

// And plot the bode like representation of the digital filter
subplot(2,1,1);
plot2d(Fs*frq,db_repf);
xtitle('Obtained Frequency Response (Magnitude)');
subplot(2,1,2);
plot2d(Fs*frq,phi_repf);
xtitle('Obtained Frequency Response (Phase in degree)');

iir est sauvegardé dans "svgd_iir" joint (binaire).

Cordialement,
JP Grivet



___
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] mprintf("%d *\n", nHiters, M) horizontal format iterator ?

2016-02-24 Thread Serge Steer


As far as I know there is no iterator operator in C format, but it is 
quite easy to generate an "iterated format* using scilab.


suppose the patterm of the format has been save in the variable f
then the "iterated format" can be generated by
strcat( f+emptystr(1,n)," ") //here I suppose the patterns are separated 
by a space



example
//Create the data
x1=(1:5)';t1="sin(x)="+string(sin(x1));x2=(1:5)'/10;t2="cos(x)="+string(cos(x2));

f="x=%f %s";//The format template
mprintf(strcat( f+emptystr(1,2)," ") +"\n",x1,t1,x2,t2)

Le 24/02/2016 15:27, Samuel Gougeon a écrit :

Hello,

I am pretty sure that an horizontal iterator was recently implemented 
for the format
used within mprintf(), but i am failing to find any information about 
how to use it.


Or am i getting confused with this feature described in the/help 
print_conver//sion/ page:


"A field width or precision can be indicated by an |*| (asterisk) 
instead of a digit string.
In this case, an integer |value| parameter supplies the field width or 
precision.
The |value| parameter converted for output is not fetched until the 
conversion
letter is reached, so the parameters specifying field width or 
precision must

appear before the value to be converted (if any)."

?

By the way, i did not find any examples for any of both features in 
help pages

of m*print()  functions.

Thanks for any help
Regards
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


Re: [Scilab-users] bug in function iir ?

2016-02-24 Thread Serge Steer

Le 24/02/2016 11:30, grivet a écrit :
I appreciate your help; however, neither suggestion works: I still get 
the same error message.

The similar line
[frq,repf]=repfreq(hz,0.01,0.49);
has no problem
please can you save the hz value using the Scilab save function and send 
the file?

Serge
Your problem arises because one frequency value you ask for  
corresponds exactly to a zero of hz.num

log(roots(hz.num))/(2*%pi)
so you want to compute the gain in dB of a zero value which is -inf

To avoid such problem you can let repfreq to do the frequency 
discretization.

[frq,repf]=repfreq  (hz)
or equivalently
[frq,repf]=repfreq  (hz,0,0.5)
in  this case the discretization uses  varying  frequency step
Serge

Le 23/02/2016 14:41, grivet a écrit :

Le 23/02/2016 14:21, Serge Steer a écrit :

Please can you give more details :
value of Order and Fcutoff/Fs/2
and what you are doing with hz (because iir does not call dbphi)
Serge






___
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] bug in function iir ?

2016-02-23 Thread Serge Steer
Your problem arises because one frequency value you ask for  corresponds 
exactly to a zero of hz.num

log(roots(hz.num))/(2*%pi)
so you want to compute the gain in dB of a zero value which is -inf

To avoid such problem you can let repfreq to do the frequency 
discretization.


[frq,repf]=repfreq  (hz)
or equivalently
[frq,repf]=repfreq  (hz,0,0.5)

in  this case the discretization uses  varying  frequency step
Serge

Le 23/02/2016 14:41, grivet a écrit :

Le 23/02/2016 14:21, Serge Steer a écrit :

Please can you give more details :
value of Order and Fcutoff/Fs/2
and what you are doing with hz (because iir does not call dbphi)
Serge
I am just running the example found in "how to design an elliptic 
filter". Here is the code:


Order=  2;  // The order of the filter
Fs   =  1000;  // The sampling frequency
Fcutoff  =  40;// The cutoff frequency

// We design a low pass elliptic filter
hz  =  iir  (Order,'lp','ellip',[Fcutoff/Fs/2  0],[0.1  0.1]);

// We compute the frequency response of the filter
[frq,repf]=repfreq  (hz,0:0.001:0.5);
[db_repf,  phi_repf]  =  dbphi  (repf);

// And plot the bode like representation of the digital filter
subplot  (2,1,1);
plot2d  (Fs*frq,db_repf);
xtitle  ('Obtained Frequency Response (Magnitude)');
subplot  (2,1,2);
plot2d  (Fs*frq,phi_repf);
xtitle  ('Obtained Frequency Response (Phase in degree)');


with 'ellip' replaced by 'butt', and [Fcutoff/Fs/2 0] replaced 
byFcutoff/Fs/2.
I am beginning to use digital filters to treat some data. As my first 
step, I try to run the examples in the help,how to design an elliptic 
filter (using Scilab 5.5.1, Win7-64). This works . However, when I 
select a Butterworth filter:

 hz = iir(Order,'lp','butt',Fcutoff/Fs/2,[0.1 0.1]);
I get this error message:

Singularité de la fonction log ou tan.
at line   6 of function dbphi called by :
[db_repf, phi_repf] = dbphi(repf);

What did I miss ?
No bugs have been reported for function dbphi, but three similar 
bugs are listed for iir.

Any suggestion welcome.
JPGrivet




___
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 replicate what "load" does (aka creating variable in the current workspace from inside a function)?

2016-02-22 Thread Serge Steer

The following function does the job:

function myload()
  txt=["a=1";"b=2"];
  ncur= size(who("local"),"*")
  execstr(txt);
  vars=who("local");
  vars=vars(1:size(vars,'*')-ncur-1)
  args=strcat(vars,",")
  execstr("["+args+"]=resume("+args+")")
endfunction

Serge
Le 22/02/2016 11:21, Antoine Monmayrant a écrit :

Hi all,

I need to create variables dynamically depending on what I parse from a text 
file.
For testing, I just made a simple script that parses the file and generates a 
string array that defines some variables:
 txt=["a=1";"b=2"];
I then
 execstr(txt);;
to create the variables needed (here "a" and "b").
So far, so good.
Now, I need to refactor my code to turn my messy script into a proper set of 
functions (see example code below).
The issue now is that I can't figure out how to define "a" and "b" from within 
the function.
I tried to declare them as "global" inside the function, but it does not work: 
as I haven't  declared them global at the top level before calling my function, it cannot 
work.
Sadly, as I don't know in advance the variables I'll find when I parse the 
file, I cannot declare the variables global at the top level.

Any solution or workaround?

Cheers,

Antoine

/example code

//script version:

clear a b;
exists("a")// nope
exists("b")// nope
txt=["a=1";"b=2"];//typical result from parsing my txt file
execstr(txt);
exists("a")// yes
exists("b")// yes

//now with a function

//broken & useless
function myload()
 txt=["a=1";"b=2"];
 //string to declare a and b global
 globaltxt="global "+strsubst(txt, '/=.*/', ';','r');
 //does not work
 execstr(globaltxt);
 execstr(txt);
endfunction


//does not work
clear a b;
exists("a")// nope
exists("b")// nope
myload()//
exists("a")// nope
exists("b")// nope


//this will work
clear a b
exists("a")// nope
exists("b")// nope
global a b // well I can't do that in practice, I don't know a and b in advance
myload()//
exists("a")// nope
exists("b")// nope



___
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] Plotting as stem function

2016-02-20 Thread Serge Steer

Le 20/02/2016 03:07, Chema a écrit :

Hi,

I have a problem when I'm trying to plot as in "stem" function in matlab
using plot2d3, my scilab code is:

n=0:20;
x=cos(2*%pi*4.*n);
plot2d3(n,x)

tha plot shows some values in 0, why if the vector x is all ones?




Which Scilab version do you use?
I have tried your code on Scilab-5.5.2 and it gives good result.

The y axis of your plot ranges from 1 to 1, so if a value is slightly less than 
1 (due to rounding errors) the bar dispears

You can fix the problem changing the y axis limits
ax=gca();
ax.data_bounds(1,2)=0;





--
View this message in context: 
http://mailinglists.scilab.org/Plotting-as-stem-function-tp4033516.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] Hilbert transform query

2016-02-09 Thread Serge Steer

X = hilbert(data)  computes the hilbert transform of data(:) not a N 
dimensionnal Hilbert transform.
Please find attached a function which is intended to compute the N dimensionnal 
Hilbert transform obtained applying
the 1D hilbert transform to all columns then to all rows, 

This function exploits the ability of fft to compute all fft along a given 
dimension with a single call.
Serge
 



Le 08/02/2016 17:51, Lester Anderson a écrit :

So what would the syntax be for doing a column run Hilbert, and row run Hilbert?

It does sound like the suggesting would do what I think it is meant to.

X = hilbert(data) // does compute pretty fast!

At the moment I have used the netCDF code to read in GMT (net CDF)
data, which is a 601 x 601 matrix (x,y). So in order to do the column
and row method is it necessary to transpose the matrix, e.g. x = x' ?

Thanks for any pointers

On 5 February 2016 at 19:02, Tim Wescott <t...@wescottdesign.com> wrote:

Any time you go from 1D to 2D you suddenly end up with more than one way
to do things, so I'm pretty sure that "how would one..." should really
be worded "how would YOU...", or perhaps "how would someone in this
field...".

It sounds like you want to keep things rectilinear, so it may be best to
just apply the transform column-by-column and row-by-row.  That SHOULD
work, and if you do it as matrix operations it should be pretty fast in
Scilab.

On Fri, 2016-02-05 at 12:52 +, Lester Anderson wrote:

Hi Serge,

I am working with grid data, so looking for the 2D Hilbert, the
results I think should appear similar to doing a directional
derivative, where X highlights features with N-S trends and E-W for Y.

Lester



On 5 February 2016 at 12:24, Serge Steer <serge.st...@inria.fr> wrote:

Le 05/02/2016 10:56, Lester Anderson a écrit :

Hello

A quick query. How would one define the Hilbert transform of a grid
for X and Y directions; looking for two solutions Hx and Hy (for the
real values).

Can you explain more precisely what you expect?
  Do you want to apply Hilbert transform to each column and to each rows or
to perform a 2D Hilbert transform?
Serge


Thanks
Lester
___
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

--

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


function x = hilbertND(x)
// Marple, S.L., "Computing the discrete-time analytic signal via FFT,"
// IEEE Transactions on Signal Processing, Vol. 47, No.9 (September
// 1999), pp.2600-2603
// http://ieeexplore.ieee.org/iel5/78/16975/0078.pdf?arnumber=78

if  type(x)<>1 then
error(msprintf(gettext("%s: Wrong type for input argument #%d: Array of 
floating point numbers expected.\n"),"hilbert",1))
end
if x==[] then return;end
if ~isreal(x,0) then
error(msprintf(gettext("%s: Input argument #%d must be 
real.\n"),"hilbert",1));
end
d=size(x);
for k=1:size(d,'*')
  n=d(k)
  if k<>1 then 
x=permute(x,[k,1]);
  end
  dp=size(x)
  x=matrix(x,d(k),-1)
  x = fft(real(x),-1,1);
  h=zeros(x)
  no2 = int(n/2);
  if ((2*no2) == n) then  // n is even
h([1,no2+1],:) = 1;
h(2:no2,:) = 2;
  else // n is odd
h(1,:) = 1;
h(2:(n+1)/2,:) = 2;
  end
  x = fft(x.*h,1,1);
  x=matrix(x,dp)
  if k<>1 then x=permute(x,[k,1]);end
end
endfunction
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Hilbert transform query

2016-02-05 Thread Serge Steer

Le 05/02/2016 10:56, Lester Anderson a écrit :

Hello

A quick query. How would one define the Hilbert transform of a grid
for X and Y directions; looking for two solutions Hx and Hy (for the
real values).

Can you explain more precisely what you expect?
 Do you want to apply Hilbert transform to each column and to each rows 
or to perform a 2D Hilbert transform?

Serge


Thanks
Lester
___
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] Logical zero

2016-02-01 Thread Serge Steer

Le 01/02/2016 10:16, Tim Wescott a écrit :
I believe that a = zeros(n, m) == 1 will do it, but it may not be 
either the best or the official way.



An other  solution is %f(ones(n,m))
Serge



Sent from my Verizon Wireless 4G LTE smartphone


 Original message 
From: shamikam 
Date: 02/01/2016 12:10 AM (GMT-08:00)
To: users@lists.scilab.org
Subject: [Scilab-users] Logical zero

Is there a Scilab equivalent for the false function in Matlab? I want to
create a matrix of logical zeros. Is there any other way to do it.

Shamika






--
View this message in context: 
http://mailinglists.scilab.org/Logical-zero-tp4033361.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


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


Re: [Scilab-users] Logical zero

2016-02-01 Thread Serge Steer
find below the results on my computer (Linux) for Scilab-5.5.2 and last 
nightly build



Version de Scilab : 6.0.0.1454090908   
Version de Scilab :   5.5.2.1427793548


zeros(n, m) == 1 11.788 
 1.416

zeros(n,m)>0 8.47   
  1.043

%f(ones(n,m))   9.347   
1.164

 a(1:n,1:m)=%f 4.352 0.816

*The scilab6 times are quite high!*

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


Re: [Scilab-users] 'fsolver'

2016-01-27 Thread Serge Steer
May be you can  use optim instead of fsolve using f(x)^2+alpha*norm(x)^2 
as cost function with alpha small enough
If you cannot compute the gradient of the cost function  you can use the 
numderivative function to estimate it.

Serge
Le 27/01/2016 16:54, fujimoto2005 a écrit :

The feature of my f(x) defined for x>0 is as follows.
f(x)<0 for x0 for x1=x2

'fsolver' gives some x such as x>x2 as a solution.
I want to get x1 as a solution.




--
View this message in context: 
http://mailinglists.scilab.org/fsolver-tp4033340p4033345.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] mlist parameters to a function call

2016-01-22 Thread Serge Steer

Le 23/01/2016 06:47, eddydde a écrit :

probably a newby question, but I can't get this right:

see example below, parameters for the function seem to get disordered


Any help would be welcome!

the instruction "return y" must be removed!
Serge


Ed

a1=4.6543
a2=1435.264
a3=-64.848
b=[4.6543,1435.264,-64.848]
c=[4.6543,1435.264,-64.848;
 1,2,3]
d.name='ed'
d.aa=c
disp(10^(a1-a2/(373.15+a3)))

function y=pv(T,x)
 t=x(1)-x(2)/(T+x(3))
 y=10^t
 disp(y)
 return y
endfunction

pv(373.15,[a1,a2,a3])
pv(373.15,b)
pv(373.15,c(1,:))
pv(373.15,c)
pv(373.15,d.aa(1,:))
xa=[273:10:373]
pv(xa(11),b)
pv(xa,[a1,a2,a3])
pv(xa,d.aa(1,:))




--
View this message in context: 
http://mailinglists.scilab.org/mlist-parameters-to-a-function-call-tp4033316.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] Loop query - Scilab 5.5.2

2016-01-18 Thread Serge Steer

The plot instruction should be inside de loop

k=0;
st=["r","g","b"];
for Te = 5000:1:25000 // start: step: end
k=k+1
D = E*Te .^3/(12*(1-v^2));
lamda = ((rho_m-rho_fill)*g ./(4*D)).^0.25;
lamda_k = lamda*1000;
flex = 
[flex,2*Pb*lamda/((rho_m-rho_fill)*g)*exp(-lamda_k*x).*cos(lamda_k*x)];
plot(x,flex,st(k))
 end



or you may build a three column array . in the script below I assume x 
is a column vector


flex=[];
for Te = 5000:1:25000 // start: step: end
D = E*Te .^3/(12*(1-v^2));
lamda = ((rho_m-rho_fill)*g ./(4*D)).^0.25;
lamda_k = lamda*1000;
flex = 
[flex,2*Pb*lamda/((rho_m-rho_fill)*g)*exp(-lamda_k*x).*cos(lamda_k*x)];
 end
plot(x,flex)


Le 18/01/2016 11:50, Lester Anderson a écrit :

Thanks for that pointer.

The plot works but only does Te=25 in this case

for Te = 5000:1:25000 // start: step: end
 D = E*Te .^3/(12*(1-v^2));
 lamda = ((rho_m-rho_fill)*g ./(4*D)).^0.25;
 lamda_k = lamda*1000;
 flex = 2*Pb*lamda/((rho_m-rho_fill)*g)*exp(-lamda_k*x).*cos(lamda_k*x);
end
plot(x,flex)

Can't get it to loop and plot the other values


On 18 January 2016 at 10:38,   wrote:

Hello,



for Te = 5000:25000:1 // start:end:step to make 5000, 15000, 25000

The syntax is start:step:end, not start:end:step

https://help.scilab.org/docs/5.5.2/en_US/colon.html

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



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


Re: [Scilab-users] plot versus date

2016-01-18 Thread Serge Steer

Le 18/01/2016 09:15, jbaud...@insa-rennes.fr a écrit :

Hi,

Le 18/01/2016 09:00, anna78 a écrit :

Hi all,
I'm beginner of SCILAB.

I have the file here after reported, made of 5 columns.
I would like to plot column 4 versus column 1, column 1 being a date 
in the

yymmdd format.
Is there any way to make SCILAB understand the x-axis is a date in 
yymmdd

format?



I think, first you need to split yymmdd in a vector [yy,mm,dd]
> yy=floor(meas_date/1);
> mm=floor(meas_date/100)-100*yy;
> dd=meas_date-100*mm-1*yy;
and convert this vector with datenum([yy,mm,dd])


and see also the x_ticks property in the axes_properties help page.

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


Re: [Scilab-users] How to use champ

2015-12-15 Thread Serge Steer

Here is an example

//First draw the "champ". System1 does not depend on time so the time value is 
not used
xr=130:10:290;yr=5:0.3:9;t=0;
clf();fchamp(System1, t, xr, yr)

//now draw the trajectory from given initial point
t=0:0.1:30; //It is not useful to ask for too many points,
 //here t gives the instants of observation of the solution not the 
integration step
y=ode (y0,t0,t,System1);

plot(y(1,:),y(2,:));


Le 14/12/2015 08:47, shahriqeen a écrit :

I am a new user to this scilab. How to plot the champ of this system

function f=System1(t, y);
  f = zeros (2,1);

  f(1) = A*y(1)-(B*y(1)*y(2));
  f(2) = (-C*y(2))+(D*y(1)*y(2))

endfunction

A=0.4;
B=0.06;
C=0.12;
D=0.0006;
t0=0;
y0=[140;6];
t=0:0.001:150;
 y=ode (y0,t0,t,System1);
 
 plot2d(y(1,:),y(2,:),1);

 xtitle ('System1');
 xlabel('x');
 ylabel ('y');



--
View this message in context: 
http://mailinglists.scilab.org/How-to-use-champ-tp4033219.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] unable to set style for histplot

2015-12-15 Thread Serge Steer

Le 15/12/2015 03:42, fujimoto2005 a écrit :

d = grand(1000,1,"bin", 6, 0.5);

c = linspace(-0.5,6.5,8);

clf()

subplot(2,1,1)

histplot(c, d, style=2)

xtitle("normalized histogram")

subplot(2,1,2)

histplot(c, d, normalization=%f, style=5)

xtitle("non normalized histogram")
The style argument rule the color of the lines and it appear to work as 
expected under sclab-5.5.2 (Linux) voir fichier joint.


Serge Steer


Figure.pdf
Description: Adobe PDF document
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Plotting properties of digital audio filters

2015-12-11 Thread Serge Steer

Le 11/12/2015 18:03, fred_audio_dsp a écrit :

Hi Rafael,

Thank you very kindly for your assistance so far!

If I understand correctly, the unwrap() macro quoted in your message has
been part of Scilab since somewhere in 2014, am I wrong?

Using scilab's phasemag() macro as suggested, I get the exact same output as
when plotting the phase with the code posted in my first message:
take care of the second input argument of phasemag. To obtain an 
unwrapped phase you must pas "c" as the second argument.

Serge

phi=(atan(imag(A),real(A)))*180/%pi


Kind regards,

Frederik



--
View this message in context: 
http://mailinglists.scilab.org/Plotting-properties-of-digital-audio-filters-tp4033198p4033204.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] Subplot figure size

2015-12-08 Thread Serge Steer

Le 08/12/2015 10:41, petarf a écrit :

Hello,

How to change subplot size of figure but not to change the whole size
figure? I have managed to change one subplot size but I also changed the
whole figure to that size.

Thanks, Petar



--
View this message in context: 
http://mailinglists.scilab.org/Subplot-figure-size-tp4033189.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


The axes size is controlled by the axes_bounds property of the axes entity
example

fig=scf(0);
ax=gca()
ax.axes_visible="on";
ax.axes_bounds=[0 0 1/2 1/3];
ax1=newaxes();
ax1.axes_visible="on";
ax1.axes_bounds=[0.3 0.5 1/2 1/3];

The axes_bounds values are given in proportions of the axes_size 
property of the figure entity.


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


Re: [Scilab-users] Set default working directory at start

2015-12-01 Thread Serge Steer


You can create a scilab.ini file the directory pointed to by the Scilab 
variable SCIHOME. The Scilab instructions stored in the scilab.ini file 
are executed eac time Scilab is loaded.


Serge Steer

Le 01/12/2015 12:09, Lester Anderson a écrit :

Hello,

A basic query, but how can I make sure that the default starting
directory is set to say c:\programs\scilab_work ?  Every time Scilab
starts it is deafulted to c:\windows\system32\ - there is no
preference option to set this in 5.4.1 (windows 64-bit).

I can change to the working directory fine, but it can be time
consuming if you have long paths to deal with.

There is no scilab.ini file - and not sure what would go in this if it
is required.

Thanks

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



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


Re: [Scilab-users] Help with bvodeS & bvode and unusual boundary conditions

2015-11-12 Thread Serge Steer
in zeta you will give the locations (relative to y) of your boundary
conditions
in your case something like [0 0 0 , L  L L ]
if you have 6 states 3 with initial constraints and 3 with final contraints
The constraints  should then be defined by the gsub  and dgsub functions

Serge
Le 12/11/2015 11:09, amonm...@laas.fr a écrit :
> Hi everyone,
>
> I'm trying to understand how bvodeS works and whether I can use it to
> solve numerically my problem.
> A bit of context:
> I have a 1D coupled-mode problem, where I model the propagation along
> one direction (let's call it y) of two modes (one in +y-direction and
> one in the -y-direction).
> Schematically, it looks like this:
>
> a(0) -->| ODE |-->a(L)
> b(0) <--| ODE |<--b(L)
>
> The ODE is of the first order (only a(y), b(y) and a'(y) and b'(y) in
> the ODE, together with non-constant factors).
>
> The thing is that I have scattering-like boundary conditions.
> I know the inputs [a(0)=a0;b(L)=bL] and look for the outputs [a(L)=?;
> b(0)=?].
> I am of course also interested in  the values of [a(y), b(y)] for all
> y in [0,L], but the puzzling issue are my boundary conditions.
> I basically half of my conditions on one side, the other half on the
> other side.
> Can I solve such a system using bvodeS?
> If I can, how am I supposed to build "zeta" to reflect that my
> conditions only concerns a(0) and b(L)?
> Is this doable to get zeta "with holes"?
>
> Thank you in advance for your help,
>
> 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


Re: [Scilab-users] Faster PWM signal

2015-10-16 Thread Serge Steer
Try with lower solver tolerances  with the Simulate/Confiure menu.

Serge Steer
Le 15/10/2015 18:53, Michael Greenish a écrit :
> Hello,
>
> I am modeling an electrical circuit.  I have a voltage across an
> inductor being switched on the ground side.  I am generating a pwm
> using a sawtooth genartor as shown by the attached image.  In my
> circuit, my PWM switches at 50kHz.  When if I set the sawtooth
> generator period to > 0.025, the results look as expected on the
> graphs.  If the sawtooth generate period is < 0.025, the results are
> flat; the system can't seem to calculate at that interval.  The period
> on the timer attached to the scope is 0.0001.
>
> I am only at 25ms, I need to get to 0.02 ms to match my real-life
> circuit.  Is there a limit of the system I am running into or do I
> have a parameter wrong?
>
> Thanks,
>
> Mike Greenish
>
>
>
> ___
> 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] read format

2015-10-13 Thread Serge Steer
It is possible to achieve what you want using the following instruction.
It is a little tricky, may be a C format expert can do it in a more
simple way.
u=mopen("",'r')
x=mfscanf(-1,u,"%*s %*2s%*[:]%*2s%*[:]%*2s%*[;]%g%*s");
mclose(u)

Serge Steer
Le 13/10/2015 16:19, sgoug...@free.fr a écrit :
> Hello,
>
> - Mail original -
>> De: "CHEZE David 227480" <david.ch...@cea.fr>
>>
>> .../... Would you need to get the timestamps data, you may call csvRead with 
>> "string" conversion and process the first column of the matrix of string to 
>> retrieve numeric value fields. 
> For this part, using mfscanf() as suggested by Serge will be more 
> straightforward, instead of csvRead().
>
> 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] read format

2015-10-12 Thread Serge Steer
with s given as follow
s=['01/03/2015 00:01:00;5.49;1'
'01/03/2015 00:01:01;5.9;1'
'01/03/2015 00:01:11;4.9;1']
The following instructions returns the expexted results
msscanf(-1,s,"%*s %*2s%*[:]%*2s%*[:]%*2s%*[;]%g[^;]%*[;]")

But I do not succeed if the data are stored in a file
u=mopen("","r")
mfscanf(-1,u,"%*s %*2s%*[:]%*2s%*[:]%*2s%*[;]%g[^;]%*[;]")
returns an error

I think a C format specialist could be able to find my error

Serge
Le 12/10/2015 14:26, grivet a écrit :
> Hello,
> I have a data file of about 80k lines. A typical line looks like this:
> 01/03/2015 00:01:00;5.49;1
> (date time; value;parameter). I am only interested in the field
> "value", which can be 3 or 4
> characters wide (i.e. 5.49 or 5.4).
> How can I extract the desired data from this file ?
> Thank you for your help.
> JP Grivet
> ___
> 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 produce a filled staircase plot

2015-10-07 Thread Serge Steer
Under Scilab-5.5.2 xfpoly rescale the graph automatically as plot does

A little more simple (efficient?) code:

t = [ 0  2  5 10 12 17 20 30 35 45 60]'*0.1;
N = [20 18 15 14 12  9  6  4  3  2  1]';

t2=matrix([t' t($); t' t($)],-1,1);
N2=matrix([0 N'; N' 0],-1,1)

clf;
xfpoly(t2,N2);
h = gce();
h.line_mode = "off";
h.background = color('gray');
plot(t2(2:$-1),N2(2:$-1),'black', t2(2:$-1),21*exp(-t2(2:$-1)/2),'red');
 



 
Le 07/10/2015 09:58, Antoine Monmayrant a écrit :
> Le 10/07/2015 09:41 AM, Yann DEBRAY a écrit :
>> Hello Raphael,
>>
>> Nice plot, but sadly it doesn't rescale.
>> Do you have an idea how to make it fit the axes, to rescale
>> automatically?
>
> You can calculate your data_bounds and set them after plotting.
> Alernatively, use my method that does not rely on xfpoly, but on plot
> that rescales automatically:
>
> //I want to staircase plot N(Decay_times)
> N=[N2,N2-cumsum(ones(Decay_times))+1];
> Np1=[N2-cumsum(ones(Decay_times))+1,0];
> Ns=matrix([N;Np1],2*prod(size(N)));
> Decay_times=[0,Decay_times];
>
> D_t=matrix([Decay_times;Decay_times],2*prod(size(Decay_times)));
> //in the end, I plot Ns(D_t)
> Ns=[0;Ns];
> D_t=[0;D_t];
> //plot it
> plot(D_t,Ns, 'k-');
> //fill the bacground
> e=gce();
> e.children.polyline_style=1;
> e.children.closed='off';
> e.children.background=color('gray');
>
>>
>> Yann
>>
>> Le 07/10/2015 00:17, Rafael Guera a écrit :
>>> Hello Antoine,
>>>  
>>> An attempt below, not particularly clean but I hope not too dirty either:
>>>  
>>> //INPUT
>>> t = [ 0  2  5 10 12 17 20 30 35 45 60]'*0.1;
>>> N = [20 18 15 14 12  9  6  4  3  2  1]';
>>>  
>>> t2=[];N2=[];
>>> ns= length(t);
>>> t2(1:2:2*ns) = t;  
>>> t2(2:2:2*ns) = [t(2:$)-%eps; t($)];
>>> N2(1:2:2*ns-1) = N;
>>> N2(2:2:2*ns) = N;
>>> clf;
>>> xfpoly([t2(1)-%eps;t2;t2($)+%eps],[0;N2;0]);
>>> h = gce();
>>> h.line_mode = "off";
>>> h.background = color('gray');
>>> plot(t2,N2,'black', t2,21*exp(-t2/2),'red');
>>>  
>>>  
>>> Regards,
>>>  
>>> Rafael
>>>  
>>> -Original Message-
>>> From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Antoine 
>>> Monmayrant
>>> Sent: Tuesday, October 06, 2015 10:57 AM
>>> To: Users mailing list for Scilab <users@lists.scilab.org>
>>> Subject: Re: [Scilab-users] How to produce a filled staircase plot
>>>  
>>> Thank you Serge for this solution, but it does not work for me: the "bars" 
>>> in my case are not regular.
>>> I am simulating an exponential random decay: starting from a number N0, my 
>>> population decreases by jumps of N0->N0-1 that occur at random times, 
>>> following an exponential law (see the attached plot).
>>> For the moment, I just build my polygon by hand, but it adds quite a lot of 
>>> "noise" on top of the code that I intent to show to my students.
>>> I was hoping for a cleaner solution.
>>>  
>>> Thanks anyway,
>>>  
>>> Cheers,
>>>  
>>> Antoine
>>>  
>>> Le Mardi 6 Octobre 2015 11:42 CEST, Serge Steer < 
>>> <mailto:serge.st...@inria.fr> serge.st...@inria.fr> a écrit: 
>>>  
>>>> Le 06/10/2015 00:01, Antoine Monmayrant a écrit :
>>>>> Hi everyone,
>>>>>
>>>>> I'm trying to do a filled staircase plot (ie a staircase where the area 
>>>>> between the staircase and the x axis is filled with a solid color).
>>>>> Is there a given combination of polyline_style and fill_mode, etc ... 
>>>>> that can do this?
>>>>> Or should I resort to building a polygon by hand?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Antoine
>>>>>
>>>>> ___
>>>>> users mailing list
>>>>>  <mailto:users@lists.scilab.org> users@lists.scilab.org
>>>>>  <http://lists.scilab.org/mailman/listinfo/users> 
>>>>> http://lists.scilab.org/mailman/listinfo/users
>>>>>
>>>> May be the bar mode can help you
>>>> x=linspace(0,%pi,10);y=sin(x);
>>>> clf;plot(x,y);e=gce();e=e.children;
>>>> e.po

Re: [Scilab-users] How to produce a filled staircase plot

2015-10-06 Thread Serge Steer
Le 06/10/2015 00:01, Antoine Monmayrant a écrit :
> Hi everyone,
>
> I'm trying to do a filled staircase plot (ie a staircase where the area 
> between the staircase and the x axis is filled with a solid color).
> Is there a given combination of polyline_style and fill_mode, etc ... that 
> can do this?
> Or should I resort to building a polygon by hand?
>
> Thanks in advance,
>
> Antoine
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
May be the bar mode can help you
x=linspace(0,%pi,10);y=sin(x);
clf;plot(x,y);e=gce();e=e.children;
e.polyline_style=6;e.bar_width=0.5;
e.background=2;
e.line_mode="off";
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread Serge Steer
Le 29/09/2015 15:58, Peter Q. a écrit :
>
> Hi.
> I need your help.
> Is there a function for distance between two points?
>
If your points are given by cartesian coordinates stored in 2 arrays  p1
and p2
you can compute the distance between these 2 points with
norm(p2-p1)
or equivalently by
sqrt(sum(p2-p1).^2)
Serge Steer
>
> Thanks in advance.
>
>
>
> ___
> 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 replace Matlab stairs function in Scilab

2015-09-24 Thread Serge Steer
Thers is no stair function but you can obtain this king of plot using
the polyline_properties:

clf;plot(sin(linspace(0,2*%pi,40)))
e=gce();//plot creates an entity of type compound
p=e.children;//the handle on the polyline
p.polyline_style=2; //set stair case mode

Serge Steer

Le 24/09/2015 05:11, Robert McLean MD PhD a écrit :
> So here is what I did for the stairs graph: 
>
> // we are going to make a stair step graphing program in scilab
> //  o--o
> //  o--o|  |
> // ||  o---o
> // oo
> //
> // We take the vector (x1,x2,x3,...,xn) and (y1,y2,y3,...,yn) and instead of 
> // graphing a lines from the data points (x1,y1) to (x2,y2), (x2,y2) to
> (x3,y3),
> // etc., we graph (x1,y1) to (x2,y1) then (x2,y1) to (x2,y2), etc. 
> //
> // the number of graphed points goes from n to 2n-1. 
>
> // (x1,x2,...,xn) 
> // (y1,y2,...,yn) goes to
> // (x1,x2,x2,x3,x3,x4,x4,...)
> // (y1,y1,y2,y2,y3,y3,y4,...)
>
> function stairs(x,y)
> n=length(x);
> x_indices=int((1:2*n-1)/2)+1; // gives 1,2,2,3,3,...,2n-1,2n-1
> x_ss=x(x_indices);  // the stair step graph's x values
> y_indices=int((2:2*n)/2);  // gives 1,1,2,2,...,2n-2,2n-2,2n-1
> y_ss=y(y_indices)
> plot2d(x_ss,y_ss)
> endfunction
>
> // We create an example: 
> n=10;
> x=linspace(0,2,n);
> x=x.*x;  //irregularly spaced x interval points from 0 to 4
> y=sin(x*%pi);
> stairs(x,y)
>
>
>
> --
> View this message in context: 
> http://mailinglists.scilab.org/How-to-replace-Matlab-stairs-function-in-Scilab-tp2615846p4032896.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] animation of multiple plots

2015-09-15 Thread Serge Steer
Le 15/09/2015 15:57, grivet a écrit :
> Hi,
>
> I am trying to animate multiple plots. For instance, when modeling the
> motion of a planet
> around the sun, I wish to plot, in one window, the planet's position
> and, in another window, the tip of the velocity vector, both plots
> evolving with time.
> I can do that in principle with the following algorithm.
> for each time point
> compute x,y,vx,vy
> define he2 handle of the trajectory
> define he6 handle of the velocity curve
> drawlater()
> subplot(1,2,1)
The subplot instruction above is of no use
> update trajectory: he2.children(1).data =
> [x(t(1:i)),y(t(1:i))]
> subplot (1,2,2)
The subplot instruction above is of no use
> update velocity: he6.children(1).data =
> [vx(t(1:i)),vy(t(1:i))]
> drawnow()
> record gif image
> update x,y,vx,vy
> end
> Using imageMagick, I then combine all the gif's in an single animation
> file.
>
> This process works on my computer. I can visualize the animation using
> Irfanview,
> Chrome or Internet Explorer, but not Firefox which shows only the last
> image.
> The situation gets worse when I try to post this animation on the Net:
> no program
> that I know of can display the animation, they all display the first
> image.
>
> I have written other animations which behave properly (see
> https://grenoble-sciences.ujf-grenoble.fr/pap-ebook/grivet/liste-animations).
> However, there is one,
> probably significant, difference: these working animations don't use
> multiple windows.
>
Strange. It does not seem to be a Scilab problem, Each gif image is a
bitmap so  there is no reason why several sub windows create a problem

> I would be very grateful for any suggestion on how to run two
> animations side by side.
> Thank you in advance for your time and help.
> JP Grivet
>
>
> ___
> 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] save all variables

2015-08-24 Thread Serge Steer

I think
save('testall.data','all')
does the job

Le 24/08/2015 04:31, fujimoto2005 a écrit :

Can scilab5.5.2 save all variables without writing the names of all
variables?
The following script failed at the last line.
scilab6.0 alpha can save all variables.

x=1:10;
y=10;20;
save('test.data','x','y');//succeed
save('testall.data');//fail

Best regards




--
View this message in context: 
http://mailinglists.scilab.org/save-all-variables-tp4032715.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] number od decimals with csvWrite

2015-06-26 Thread Serge Steer

The simplest way is to use round

A=rand(3,3);
B=round(100*A)/100;

Serge Steer
Le 25/06/2015 22:07, Simone Meroni a écrit :

Hi
I want to write some data and export them with

csvWrite

I need to have no more than 2 decimals for aesthetic reasons.

How can I set the number of decimals?

Thanks,

Simone Meroni


___
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] Questions about handling cursor from Scilab

2015-06-08 Thread Serge Steer
Hello,

Does anyone knows how to

  * modify the pointeur coordinates into a Scilab graphic window with
Scilab instruction?
  * modify the pointeur icon with Scilab instruction?

Thanks

Serge Steer



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


Re: [Scilab-users] Accidentally displaying huge matrices

2015-05-27 Thread Serge Steer
Le 27/05/2015 10:46, Samuel Gougeon a écrit :
 Le 27/05/2015 10:06, Lamy Alain a écrit :
 Maybe define a second function  ?

 disp = displays in the julia way (for instance)
 disp_all =  display all elements whatever the size (it's the user
 responsibility to limit the size to something reasonable)
 I guess that Serge was wondering about the default display, when an
 instruction is not followed by ;.
 disp() is something else. When we use disp(), the output is
 intentional and required. So there should not have any abstract with
 disp().

 For the default output, i rather agree with Serge. But the limit
 between a full display and an abstract should be tunable (in addition
 to a switch to an non-wrapped mode).
 For instance, a max number of lines set through lines() 0 could mean
 that an abstract is preferred for taller output. If it is 0, the
 pagging mode is preferred. And if it is 0, no limit would be set (as
 it is presently).

Just take care that lines() does not rule olny the display of a
variable, it also rules the display of all outputs generated by an
intruction as in the following example:

lines(10)
for i=1:20,i,end


Serge
 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] Accidentally displaying huge matrices

2015-05-27 Thread Serge Steer
For me displaying a huge matrix (or huge structure) on the screen has in
general no interest. So it should be convenient to display only its size
and type as it is done when displaying a struct which contain a large array:
--S.A=rand(1000,1000)
S  =
 
   A: [1000x1000 constant]
This solution can be set as a default display mode, keeping others as
options.

Serge Steer

 25/05/2015 15:29, Antoine Monmayrant a écrit :
  
 Le Samedi 23 Mai 2015 00:05 CEST, Samuel Gougeon sgoug...@free.fr a écrit: 
  
 Hello Tim,

 Le 21/05/2015 17:48, Tim Wescott a écrit :
 .../...
 First, is there a way to get it to stop?  ctrl-C does not do the job.
 In your startup file .scilab or scilab.ini, you may add the instruction
 lines(1000)
 in order to turn on the pager and make it prompting the user to continue 
 listing lines after each block of 1000 lines (or whatever you want).
 At the prompt, CTRL+C + abort works.
 OK, but this also interrupts the execution of any script that display more 
 than 1000 lines on the command line!
 This can be particularly annoying when using scripts that process big data 
 and  output some progression infos on the command line.
 It's never nice to find out the next morning that your script stopped at 10% 
 to ask whether it should keep on displaying text.
 For me, this is more a workaround (with one big caveat) than a real solution.
 The Julia way of displaying big matrices seems interesting.
 Would it be hard to implement?
 (honest question, I have no idea what work it implies)
 As someone filled a bug/feature request?

 Cheers,

 Antoine

 Regards
 Samuel

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

  
  
  
  


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

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


Re: [Scilab-users] fscanfMat help

2015-05-26 Thread Serge Steer
Le 19/05/2015 18:02, Francesco Pedretti a écrit :
 Dear all,

 I started to use Scilab only last week and I have some problems with
 the command fscanfMat. I have to read three text file in order to
 create a post processing of a fortran file. The problem is that the
 code today decided to not open these files (yesterday it worked). I
 tried also wth the command mopen and mgetl but it doesn't work. The
 error message is the 999 cannot open the file.

Using  A=fscanfMat('flux.txt'); supposes that the Scilab working
directory contains the flux.txt file.
You can change the Scilab working directory with the cd function.
Serge Steer


 In attachment I send also the scilab script and the three txt files.
 Thanks for your help.

 Best regards,

 Francesco Pedretti


 ___
 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] Accidentally displaying huge matrices

2015-05-26 Thread Serge Steer
Le 25/05/2015 15:29, Antoine Monmayrant a écrit :
  
 Le Samedi 23 Mai 2015 00:05 CEST, Samuel Gougeon sgoug...@free.fr a écrit: 
  
 Hello Tim,

 Le 21/05/2015 17:48, Tim Wescott a écrit :
 .../...
 First, is there a way to get it to stop?  ctrl-C does not do the job.
 In your startup file .scilab or scilab.ini, you may add the instruction
 lines(1000)
 in order to turn on the pager and make it prompting the user to continue 
 listing lines after each block of 1000 lines (or whatever you want).
 At the prompt, CTRL+C + abort works.
 OK, but this also interrupts the execution of any script that display more 
 than 1000 lines on the command line!
 This can be particularly annoying when using scripts that process big data 
 and  output some progression infos on the command line.
If one as set lines(1000), it is possible to stop the display just
entering n when the system proposes to continue or to stop the display.
 It's never nice to find out the next morning that your script stopped at 10% 
 to ask whether it should keep on displaying text.
 For me, this is more a workaround (with one big caveat) than a real solution.
 The Julia way of displaying big matrices seems interesting.
 Would it be hard to implement?
 (honest question, I have no idea what work it implies)
 As someone filled a bug/feature request?

 Cheers,

 Antoine

 Regards
 Samuel

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

  
  
  
  


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

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


Re: [Scilab-users] ”Too complex recursion”

2015-05-19 Thread Serge Steer
Le 19/05/2015 03:27, fujimoto2005 a écrit :
 When I use the function 'intg', I have an message Too complex recursion!
 (recursion tables are full) and the code stop to run.
 But the user-function for the ‘intg’ calls only two user functions with same
 level in it.
 How can I fix this problem?
 I already maximized the stack seize by stacksize('max').
The Too complex recursion! message has nothing to do with the stack
size. It is often due to a function which calls itself (directly or
indirectly) too deeply.
Does your user function calls 'intg'?

Serge Steer



 --
 View this message in context: 
 http://mailinglists.scilab.org/Too-complex-recursion-tp4032303.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] Handle event ibut=-1000 (closing figure window, red cross)

2015-05-13 Thread Serge Steer
Le 13/05/2015 10:54, khannes a écrit :
 Hello everyone!

 Is there a chance to stop the the current figure window from closing,
 although the red cross (ibut = -1000 in the figure event handler) was hit?
yes, you can set the figure closerequestfcn property to a function name

example
f=gcf()
function myclose(), disp(hello);endfunction
f.closerequestfcn=myclose

The each time you hit the red cross the hello message is send

To kill the window one then has to call delete(f)

Serge Steer
 Is there kind of an interrupt that could halt that?
 I did not figure out how i could manage to do that so far!

 Thank you in advance!

 Best regards,
 Hannes



 --
 View this message in context: 
 http://mailinglists.scilab.org/Handle-event-ibut-1000-closing-figure-window-red-cross-tp4032258.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] integral of th discontinuous function

2015-05-12 Thread Serge Steer
Le 12/05/2015 17:31, fujimoto2005 a écrit :
 I want to integrate a discontinuous function whose number of discontinuous
 points are 3-4.
 I know I can get an enough accurate result when I divide whole integrate
 range to sub-ranges over which the function is continuous and apply the
 standard intergration program such as inttrap for each range and sum the
 results.
is your function beeing given by a scilab function like y=f(t) or by a
sequence (t(k),y(k)) in the first case the inegration of the continuous
part can be done using the intg function and in the second one by inttrap.

In the second case the notion of discontinuity is not clear because you
only have a discret sequence of points

in the first case it seems that intg gives quite good results even with
a discontinuous function:

function y=f(t)
if t=1 then
y=sin(t)
elseif t=3
y=10+sin(t)
else
   y=-10*sin(t)
end
endfunction
e=1e-13;
i1=intg(0,5,f,e,e);
i2=intg(0,1,f,e,e)+intg(1+2*%eps,3,f,e,e)+intg(3+2*%eps,5,f,e,e);
i1-i2
 ans  =
 
1.421D-14 

Serge Steer
 But I want to integrate with one whole range.
 Is there a such program?






 --
 View this message in context: 
 http://mailinglists.scilab.org/integral-of-th-discontinuous-function-tp4032242.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] Ways to speed up simple things in Scilab ?

2015-04-24 Thread Serge Steer

Le 23/04/2015 23:51, Stéphane Mottelet a écrit :

Hello,

I am currently working on a project where Scilab code is automatically 
generated, and after many code optimization, the remaining bottleneck 
is the time that Scilab spends to execute simple code like this (full 
script (where the vector has 839 lines) with timings is attached) :


M1_v=[v(17)
v(104)
v(149)
-(v(18)+v(63)+v(103))
-(v(18)+v(63)+v(103))
v(17)
...
v(104)
v(149)
]

This kind of large vectors are the used to build a sparse matrix each 
time the vector v changes, but with a constant sparsity pattern. 
Actually, the time spent by Scilab in the statement


M1=sparse(M1_ij,M1_v,[n1,n2])

is negligible compared to the time spent to build f M1_v...

I have also noticed that if you need to define such a matrix with more 
that one column, the time elapsed is not linear with respect to the 
number of columns: typically 4 times slower for 2 columns. In fact the 
statement


v=[1 1
...
1000 1000]

is even two times slower than

v1=[1
...
1000];
v2=[1

1000];
v=[v1 v2];

So my question to users who have the experience of dynamic link of 
user code : do you think that using dynamic link of compiled generated 
C code could improve the timings ?

Mais  apriori je ne fais rien qui soit OS dependant...
As your code is generated it should effectively a good idea to generate 
C code and use incremental linking (once the code has been compiled and 
link you can expect a speed factor around 100 times. But the compilation 
may be slow. So using dynmaic linking is a very good idea if your 
generated code has to be run many times.

Serge

In advance, thanks for your help !

S.




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


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


Re: [Scilab-users] Help about Scilab

2015-02-04 Thread Serge Steer
please see 
http://svn.forge.scilab.org/docintrodiscrprobas/en_US/introdiscreteprobas/scripts/nchoosek.sci
 
Serge Steer 

- Mail original -

 De: Paweł Postek post...@o2.pl
 À: users@lists.scilab.org
 Envoyé: Mardi 3 Février 2015 19:35:02
 Objet: [Scilab-users] Help about Scilab

 Hello.

 My name is Pawel and i have a big problem. I have a code in matlab witch use
 nchoosek function.

 for n = 5
 for m = (1:n)
 c = nchoosek (n,m)
 end
 end

 I need to convert this code to Scilab.
 I'm trying to do this, but I fail.
 If anyone could help me?

 Thank you

 ___
 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] sparse hypermatrix definition

2014-12-19 Thread Serge Steer

There is no already built function to do that, but it cannot be very difficult 
using an mlist data structure which contains the index of non zero elements ans 
the non values. The amount of work  mainly depends on what you want to do with 
it .

Serge Steer
- Mail original -
 De: David Chèze david.ch...@cea.fr
 À: users@lists.scilab.org
 Envoyé: Vendredi 19 Décembre 2014 15:58:57
 Objet: [Scilab-users] sparse hypermatrix definition
 
 Hi all,
 
 I wonder whether there's an smart way in Scilab to define sparse hypermatrix
 (at least dim 3) as it is done with the function sparse() for dim 2?
 
 Thanks for your help,
 
 David
 
 
 
 --
 View this message in context:
 http://mailinglists.scilab.org/sparse-hypermatrix-definition-tp4031554.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] Problem with function fitting

2014-12-17 Thread Serge Steer
Your problem comes from the fact that for some values of n the computed
value of e are complex values (some negative values to a non integer
exponent. This can be made obvious with the following function

function e = G(n,z)
  xm = z(1)
  ym = z(2)
  e = ym - f1(xm,n)
  if ~isreal(e) then pause,end
 endfunction 

The solution depends on the problem you want to solve. for example one
can replage G by
function e = G(n,z)
  xm = z(1)
  ym = z(2)
  e = ym - f1(xm,n)
  e=real(e*e')
endfunction

Serge Steer

Le 17/12/2014 18:53, Maihem a écrit :
 Hi,

 I have problem with fitting function to measured data using scilab. I tried
 scilab function datafit(), lsqrsolve(), leastsq() but none returns me a
 proper result or can't perform calculations.

 //I have measured data:
 xm;ym
 2.0;99.9449173761
 1.0;99.8097145719
 0.5;97.9769654482
 0.25;36.4046069104
 0.1;1.4872308463
 0.071;0.5207811718
 0.063;0.3705558338

 //Script used to fit data

 miny=min(ym);
 maxy=max(ym);
 minx=min(xm);
 maxx=max(xm);

 Zz=[xm;ym];

 //Function describing problem (I want to find best fit by finding n()).

 function g1=f1(x, n)
 g1 = miny+((maxy-miny) ./((1+(n(1).*(x ./n(2)).^n(3))+(1-n(1)).*((x
 ./n(2)).^n(4.^n(5))
 endfunction

 function e = G(n,z)
   xm = z(1)
   ym = z(2)
   e = ym - f1(xm,n)
 endfunction 

 n0 = [1 ; 1; 1; 1; 1]
 [n0_opt,err] = datafit(G,Zz,n0) 

 After calling function scilab returns me error:
 Variable returned by scilab argument function is incorrect.

 I tried to find solution for this problem in scilab mailing lists and tried
 some posted scripts and advices but I can't localize problem.


 Łukasz



 --
 View this message in context: 
 http://mailinglists.scilab.org/Problem-with-function-fitting-tp4031546.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] Question syslin

2014-12-16 Thread Serge Steer


- Mail original -
 De: Andreas Ladanyi andreas.lada...@gmx.net
 À: users@lists.scilab.org
 Envoyé: Mardi 16 Décembre 2014 11:01:25
 Objet: [Scilab-users] Question syslin
 
 Hi,
 
 i am reading the help of scilab to understand the syslin function. In
 the help i can see 3 options for the dom parameter. There is an option
 for a sampled system 'n'.
example syslin(0.01,...) defines a discrete linear dynamical system with sample 
period equal to 0.01.

 
 In this help there is no example for a sampled system. So what is the
 difference between a discrete system and a sampled system ? What is the
 difference between an discrete system d and an sampled system n for syslin ?
 
 In the most examples i read in the web syslin is called with dom='c'.
 
 cheers,
 Andreas
 ___
 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] Command datafit for a bivarate model function z=f(x, y)

2014-12-16 Thread Serge Steer
Here is a working code

function z=!z(x,y,p)
  z=p(1)*x.^2 + p(2)*y.^2
endfunction
pg=[5;6]//parameter of fictitious data
X=0:5;Y=0:5; Z=!z(X,Y,pg)
M=[X;Y;Z];//measurement matrix, 3 rows, 6 colomns  
function e=!e(p,m),
  x=m(1), y=m(2); z=m(3),
  e=z-!z(x,y,p)
endfunction
p0=[2;3];
[p,err]=datafit(1,!e,M,p0)
z=!z(X,Y,p)

Serge Steer
- Mail original -
 De: Jens j.s.st...@hslmg.de
 À: users@lists.scilab.org
 Envoyé: Lundi 15 Décembre 2014 23:00:43
 Objet: [Scilab-users] Command datafit for a bivarate model function z=f(x,
 y)
 
 I tried to follow the pattern for data fit given in the thread
 http://mailinglists.scilab.org/Convert-x-y-z-data-into-a-z-f-x-y-function-td4026897.html#a4026925
 for the simple bivariate function
  z=p(1)*x.^2 + p(2)*y.^2
 by this script:
 
 mode(0),   lines(0),   clc(), clear
 deff( 'z=!z(x,y,p)','z=p(1)*x.^2 + p(2)*y.^2')//model function
 pg=[5;6]//parameter of fictitious data
 X=[0:5];Y=[0:5]; Z=!z(X,Y,pg)
 M=[X;Y;Z];//measurement matrix, 3 rows, 6 colomns
 deff(' e=!e(p,m)','x=M(1), y=M(2); z=M(3),e=z-!z(x,y)')//defect
 (critereon- , error-,) function
 p0=[2;3];
 [p,err]=datafit(1,!e,M,p0)
 err,
 z=!z(X,Y,p)
 
 However the script just returns p0 as solution. Would anyone kindly help me
 to find the flaw?
 
 Kind regards
 Jens
 
 
 
 
 --
 View this message in context:
 http://mailinglists.scilab.org/Command-datafit-for-a-bivarate-model-function-z-f-x-y-tp4031533.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] frequency analysis of N variables

2014-12-01 Thread Serge Steer
I think the attached function do what you expect

Serge Steer
Le 01/12/2014 17:15, David Chèze a écrit :
 Hi all,

 I have timeseries with measurements at every timestep and I would like to
 define bins of values for every variable and be able to count the number of
 records that are in each bin: for 2 variables X and Y with 3 and 5 bins
 respectively for example, the results is a matrix  3x5 where i,j element is
 : the number of measurements that are in the ith bin of X and jth bin of Y.
 I wonder if there is a direct function to address this common problem of
 classification/sorting in scilab or toolbox like stixbox or nan_toolbox or ? 

 Thanks for your advice,

 David



 --
 View this message in context: 
 http://mailinglists.scilab.org/frequency-analysis-of-N-variables-tp4031497.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


function occ=dsearch2D(xy,dx,dy,opt)
//xy, coordinates of the points of the cloud
//dx, discretization of the x axis 
//dy , discretization of the y axis 
//occ, table such as occ(i,j) contains the number of points in the
//pixel [dx(i) dx(i+1)) x [dy(j) dy(j+1))
  if argn(2)4 then opt='c';end
  if and(opt[c,d]) then
error(msprintf(_(%: unknown char specifier (must be ''c'' or 
''d'')\n),dsearch2D))
  end
  if size(xy,2)2 then 
error(Wrong dimension for first argument)
  end
  [indx,occx]=dsearch(xy(:,1),dx,opt);
  occ=[];
  dy=matrix(dy,1,-1);
  for k=1:length(dx)-1
i=find(indx==k);
[indy,occy]=dsearch(xy(i,2),dy,opt);
occ=[occ; occy];
  end
endfunction 
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] How to find module containing a function

2014-10-30 Thread Serge Steer

The dft function is lust called  fft (discrete and fast)
Serge Steer


Le 30/10/2014 04:05, Tin Nguyen a écrit :


Hi all,

I am being stuck with the function dft. My Scilab software doesn't 
include this function.


So I searched the internet to find appropriate module in order to use it.

I tried Signal_Processing_Supplementary_toolbox, but it didn't help.

Can anyone show me how to find the module that contains a particular 
function.


Thanks!



___
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] ?E embedded scilab function in XCOS

2014-10-23 Thread Serge Steer
The scifun_block (in the user defined functions palette) may be what you 
are looking for.


Serge Steer
Le 23/10/2014 18:11, Candio a écrit :

Hello,

I am looking to reflect in XCOS (Scilab 5.5.1) the Simulink EML block. I
cannot find a way to include embedded scilab code. I see a scilab function
can be called if it is loaded into the workspace, but this isn't quite what
I'm looking for. Does there exist a way to include embedded scilab code in
XCOS?

It looks like my question might be answered here; unfortunately I can't read
German.
http://www.gomatlab.de/embedded-function-block-in-scicos-scilab-t14301.html


Candio



--
View this message in context: 
http://mailinglists.scilab.org/E-embedded-scilab-function-in-XCOS-tp4031434.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] Problem with partial fraction decomposition (dfss)

2014-10-22 Thread Serge Steer

Now you are using a too big value for rmax
--pf = pfss(h)
 pf  =


   pf(1)

0.75 - 0.25s

   2
 1 - 2s + s

   pf(2)

0.25

1 + s
Some explanation
pfss converts the transfer function to state space representation and 
then trie to diagonalize the state matrix using the bdiag function


--S=tf2ss(h);
--bdiag(S.A)
 ans  =

1.000  - 1.22474490.
0.  1.  0.
0.  0.   - 1.
You can see with result above that there is a 2 by 2 jordan block (for 
the eigenvalue 1) which exhibits a coupling between the two states

Now with
--bdiag(S.A,1/%eps)
ans  =

1.0000.0.
0. 1.0.
0. 0.  - 1.
 The Jordan block has been broken

[Ab,X]=bdiag(S.A,1/%eps);cond(X)
 ans  =

5.074D+14
 bdiag has broken the jordan block using a singular base change so 
the decomposition is a non-sense.

Serge Steer

Le 21/10/2014 12:07, Tin Nguyen a écrit :

Dear Serge Steer,
Thank you very much for your response. Your code works fine.
However, I still have some problem with this pfss function. For example, I
try to decompose a fractional polynomial that has multi-order poles.
H(z) = 1  /  { (1-s)^2 * (1+s) }

You can find following from my console:
--s = poly(0,'s');
  
--h = 1 / ( (1 + s) * (1 - s)^2)

  h  =
  
   1

 -
  2   3
 1 - s - s + s
  
--pf = pfss(h, 1/%eps)

  pf  =
  
  
pf(1)
  
 - 9420237.9

 -
   - 1.000 + s
  
pf(2)
  
 9420237.6

 -
 - 1 + s
  
pf(3)
  
 0.25

 
 1 + s

I also checked:
--pf(1)+pf(2)
  ans  =
  
 0.75 - 0.25s

 
  2
  1 - 2s + s

I have no idea about this situation.
Can you help me out! Thank you in advance!

--Tin Nguyen

-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Serge Steer
Sent: Tuesday, October 14, 2014 6:36 PM
To: users@lists.scilab.org
Subject: Re: [Scilab-users] Problem with partial fraction decomposition
(dfss)

You just need to tune the rmax optionnal parameter pf =
pfss(tf2ss(hz),5);length(pf)

Serge Steer
Le 13/10/2014 10:12, tinnguyen a écrit :

Hi guys,
I'm having trouble using scilab's function pfss to decompose a
polynomial in order to do inverse Z transform. Following is my code:
-- z = poly(0,'z')
-- hz = z^2 / (1 - 6*z + 11*z^2 - 6*z^3) pf = pfss(tf2ss(hz))
-- length(pf)
The fourth command returns '1'. However, I believe it should be 3. I
also did the decomposition manually and got the result as: hz =
0.5/(1-z) + -1 /
(1-2*z) + 0.5/(1-3*z).
Nevertheless, if I change the numerator of hz from z^2 to z or z^3,
pfss works correctly. I definitely have no idea!!!? :D Please take a
look and correct me if i'm wrong.
Thank you so much!




--
View this message in context:
http://mailinglists.scilab.org/Problem-with-partial-fraction-decomposi
tion-dfss-tp4031331.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

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



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


Re: [Scilab-users] Problem with partial fraction decomposition (dfss)

2014-10-14 Thread Serge Steer

You just need to tune the rmax optionnal parameter
pf = pfss(tf2ss(hz),5);length(pf)

Serge Steer
Le 13/10/2014 10:12, tinnguyen a écrit :

Hi guys,
I'm having trouble using scilab's function pfss to decompose a polynomial in
order to do inverse Z transform. Following is my code:
-- z = poly(0,'z')
-- hz = z^2 / (1 - 6*z + 11*z^2 - 6*z^3)
-- pf = pfss(tf2ss(hz))
-- length(pf)
The fourth command returns '1'. However, I believe it should be 3. I also
did the decomposition manually and got the result as: hz = 0.5/(1-z) + -1 /
(1-2*z) + 0.5/(1-3*z).
Nevertheless, if I change the numerator of hz from z^2 to z or z^3, pfss
works correctly. I definitely have no idea!!!? :D
Please take a look and correct me if i'm wrong.
Thank you so much!




--
View this message in context: 
http://mailinglists.scilab.org/Problem-with-partial-fraction-decomposition-dfss-tp4031331.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] Calculus and Scilab

2014-09-29 Thread Serge Steer


You can use the int2d function

For yopur example, the domain is defined by a single triangle:
function z=f(x,y),z=3-x-y,endfunction

X=[0;1;1];
Y=[0;0;1];
[I,e]=int2d(X,Y,f);

Le 29/09/2014 00:15, Reinaldo a écrit :

Hi Scilab users,

I would like to plot the following 3D function in order to calculate 
the volume of that prism.


Let f(x,y) be a real function defined to f(x,y) = 3 - x - y, which 
domain region on OXY plain is limited by those functions: y = x; 
X-axis; and x = 1.


Plot f(x,y).

Do you know if there is a Scilab tutorial for Calculus?

Thank you in advance.

All best,
Reinaldo.


___
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] multiple plots

2014-08-20 Thread Serge Steer

ecau
Le 20/08/2014 15:32, grivet a écrit :
For a single plot, it is possible to choose many aspects of the plot 
using, for instance

ha = gca();
ha.data_bounds=[-5, -5 ; 20, 20];

Is it possible to have the same possibilities within subplots, like
subplot(2,1,1)
ha1 = gca();
ha1.data_bounds=[-5, -5 ; 20, 20];
subplot(2,1,2)
ha2 = gca;

take care: here you must write  ha2 = gca();
the instruction ha2=gca just copy the gca reference into ha2

ha2.data_bounds=[-1, -1 ; 2, 2];
(which does not work with Scilab 5.5/win7).

I would like to plot two different variables, with different units and 
ranges. Even more

ambitious, I would like to run different animations in each subplot.


both are possible.
for smooth animation it is better to update the polyline data instead of 
clearing the window and recreating the subwindows and their children

Serge Steer

Thank you for any suggestions.
JP Grivet

___
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] Xcos Debugging : block number, Flag and tutorial

2014-07-29 Thread Serge Steer

Le 29/07/2014 10:16, Quentin Mazué a écrit :

Hi,

I need to make some debugging in Xcos, and for that I use the block DEBUG
with the code below:

-
xcos_debug_gui(flag,block);
warnBlockByUID(block.label, ERROR);
n=curblock();
f=%cpr.sim.funs(n)
path=%cpr.corinv(n);
t=scicos_time();
printf(flag=%d, t=%g, n=%d, f=%s \n, flag,t,n,f)
if n==5 then
printf(u=%g, y=%g \n --- \n, block.inptr(1), block.outptr(1))
pause
end
-

1)
I have some difficulties in a huge diagram (several hundreds of blocks) to
find the block I want to analyze. Indeed I need to get the block number in
the scs_m structure and until now I use the following procedure:

During the debugging I wait until the simulation stop (at Flag = 1 for
example)
I use a loop with the getlabelblock(i) function until it gives me the label
of the block I want to follow.
I stop the simulation
I correct the line n==5 to n==i (i : block number that I want to follow)
I start again the simulation

= Is there a simpler way to get the block number?
You can use %cpr.sim.uids(curblock()) to get the UID of the current 
block and you can use it suspend execution when this bloc is called


if %cpr.sim.uids(n)==50cd0851:14781837c95:-7f41 the
printf(u=%g, y=%g \n --- \n, block.inptr(1), block.outptr(1))
pause
end




= Why the function xcos_blocks_info(%cpr) detailed page 209 in the book
Scilab de la théorie à la pratique written by Serge Steer and Yvon Degré
does not exist in Scilab 5.5.0? This function could be useful because we
have a direct correlation between block number and their uid.

Please find it attached

2)
Is there a list of all flag signification in Xcos?
How/When/in which order are these flags called in Xcos?

Yes,  a table is given in the book Scilab de la théorie à la pratique

3)
Are there some tutorials to explain how to debug an Xcos Diagram?
There are some details on how to  debug the scheduling in the same book. 
But debug may have a lot of meanings...


Serge Steer

// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) - 2013 - INRIA -Serge Steer
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function info=xcos_blocks_info(cpr);
//creates a tabular of the blocks used
  sim=cpr.sim;
  nblk=sim.nb;
  funs=sim.funs;
  labels=sim.labels;
  ptr=sim.xptr;sel=find(ptr(1:$-1)ptr(2:$));
  indx=emptystr(nblk,1);
  indx(sel)=string(ptr(sel))+:+string(ptr(sel+1)-1);

  ptr=sim.zptr;sel=find(ptr(1:$-1)ptr(2:$));
  indz=emptystr(nblk,1);
  indz(sel)=string(ptr(sel))+:+string(ptr(sel+1)-1);

  ptr=sim.ozptr;sel=find(ptr(1:$-1)ptr(2:$));
  indoz=emptystr(nblk,1);
  indoz(sel)=string(ptr(sel))+:+string(ptr(sel+1)-1);
  
  ptr=sim.rpptr;sel=find(ptr(1:$-1)ptr(2:$));
  indrp=emptystr(nblk,1);
  indrp(sel)=string(ptr(sel))+:+string(ptr(sel+1)-1);

  ptr=sim.ipptr;sel=find(ptr(1:$-1)ptr(2:$));
  indip=emptystr(nblk,1);
  indip(sel)=string(ptr(sel))+:+string(ptr(sel+1)-1);

  ptr=sim.opptr;sel=find(ptr(1:$-1)ptr(2:$));
  indop=emptystr(nblk,1);
  indop(sel)=string(ptr(sel))+:+string(ptr(sel+1)-1);

  info=[block number,simulation function,uid,rpar index,ipar+...
 index,opar index,z index,oz index,x index];
  for i=1:nblk
info=[info;
  
string(i),funs(i),labels(i),indrp(i),indip(i),indop(i),indz(i),indoz(i),indx(i)];
  end
endfunction

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


Re: [Scilab-users] Find the position of vector in another vector

2014-07-22 Thread Serge Steer
One can use the Morris and Pratt algrithme 
(http://www.liafa.jussieu.fr/~carton/Enseignement/Algorithmique/Programmation/Pattern/MorrisPratt/)
I give you a Scilab code of this algorithm. But it should be more 
efficient to add a builtin using the C code given at


http://www.liafa.jussieu.fr/~carton/Enseignement/Algorithmique/Programmation/Pattern/MorrisPratt/pattern.c


Le 22/07/2014 11:38, an.lld a écrit :

hello scilab users,

i have a problem, i'm trying to find a vector into another vector. my vector
looks like this:
A=[7  342  75  36  36  36  9  64  213  82  36  36  36  9  72]

i would like to find the position of the under vector
B=[36 36 36] in A
so that i get a vector C=[4 11]... (4 and 11 are the positions where the
vector B begins).

i have already tried: [v,ka,kb]=intersect(A,B), but this function searches
only the first occur of 36 in A.
has somebody  an idea how i can realize that?

sorry, for my bad english.



--
View this message in context: 
http://mailinglists.scilab.org/Find-the-position-of-vector-in-another-vector-tp4030943.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



function ind=morrisPratt(sequence,pattern)

// Calcul de la fonction de suppléance s
// Pour tout i  0, s[i] est la longueur bord maximal du 
// préfixe de longueur i du motif, c'est-à-dire p_0 ... p_{i-1}.
// Pour un préfixe w du motif, on a |bord(w)| = s[|w|].
// On a donc |bord^2(w)| = s[|bord(w)|] = s[s[|w|]].
// Les longueurs des bords d'un préfixe w sont donc les valeurs
// s[|w|], s[s[|w|]], s[s[s[|w|]]] ...
  m=length(pattern)
  n=length(sequence)
  ind=[];
  i=-1;
  s(1) = -1;
  for j = 1:m
while i = 0  pattern(i+1)  pattern(j-1)
  i = s(i+1);
end
s(j) = i+1;
  end
  // Recherche du motif
  
  j = 0;
  while jn 
i = 0;
while i  m  jn
  if pattern(i+1) == sequence(j+1) then
// Si les deux caractères coïncident, 
// les deux curseurs avancent d'une position vers la droite.
j=j+1;
i=i+1;
  else
if i==0 then
  j=j+1;
else
  i = s(i+1);
end
  end
end
if i == m then
  // Occurrence trouvée en position j-i
  ind=[ind j-i+1];
else
  // Aucune occurrence
  break
end
  end
endfunction

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


Re: [Scilab-users] Xocs : enabled superblocks and multi frequence diagram

2014-07-21 Thread Serge Steer
The solution of your problem depends the solution of your problem 
depends on the type of your state system:


- if it is a continous time state system  the xcos solver is able to 
automatically adapt its step size so, it is not necessary to handle two 
copies of your superblock
- if it is a discret time system you can use two SampleCLK block one 
with 1/10 period and the other one with 1/1000 period as explained in 
the attached xcos diagram


Serge Steer
Le 21/07/2014 08:45, Quentin Mazué a écrit :

Hello,

I need to model a special phenomenon which has two different states:

-1) A transient state: from 0 to 1 sec.
For this phase I need calculations with a very small time step (around
0.001s)

-2) Then a steady state: from 1 to end of simulation (around 10-15sec)
For this phase I need calculations with a large time step (0.1s)

Enclosed, a picture of an equivalent Simulink diagram which matches my
needs.
  
Illustration_EnabledSuperblocks_MultifreqDiagram.png

http://mailinglists.scilab.org/file/n4030940/Illustration_EnabledSuperblocks_MultifreqDiagram.png

Both phases have the same inputs calculated with the same block.

I would like to:

-a) Specify that I have 2 superblocks within the same Xcos diagram that
make the computations with different time step and a third one with a time
step which change during the simulation (the Input superblock)

-b) be able to deactivate the transient superblock when I don’t need
transient calculations and activate the steady block only when I need it.


Why I would like to do that?

-I’m working with a new way of computing a phenomenon and I have to show
that this new method is faster than the previous method and enough accurate.
If I don’t deactivate the transient block, Xcos is still running this block
and I lose all the interest of my new model.

-at the same time, I have to show that Scilab/Xocs is able to match the
need of my company. They are actually using a lot Matlab/Simulink,
especially the blocks: enabled subsystem, triggered subsystem, trigger, zero
order hold, rate transition,…



Thanks for your help

Quentin Mazué




--
View this message in context: 
http://mailinglists.scilab.org/Xocs-enabled-superblocks-and-multi-frequence-diagram-tp4030940.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




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


Re: [Scilab-users] Problems with To workspace and From workspace

2014-04-10 Thread Serge Steer

  
  
The workspace variables are created in
  the Scilab environment at the end of the simulation
  You can probably use a DOLLAR block to do what you want
  
  Serge
  Le 10/04/2014 09:27, Michael Ungelehrt a crit:


  
  
  
  
  
Dear users,

I have a problem with
the To workspace respectively From workspace block in
Xcos.

Id like to write the
value of a function to workspace if the value of another
function changes its sign from + to -. A short time later
Id like to use this value in a third function and retrieve
it from workspace.

For that I evaluate the
first function with the NEGTOPOS_f block and give the
output event to the TOWS_c block. The TOWS_c block is
connected with the second function and should write the
value to a vaiable A in the workspace.
The FROMWSB block is
connected with a third function which should use the
variable that is saved before.

Now I have the following
problem:
If I start the
simulation, the FROMWSB says that the variable A does not
exist. So my idea was to define the variable in the
variable-browser before I start the simulation. If I do so I
get an error at the TOWS_c block: Evaluation problem:
value not updated from context. Protected variable name.
Please choose another variable name.

Is there any solution
for that problem?

Block parameters:
From workspace:
Variable
name: C
Interpolation Method:
 0
Enable zero
crossing: 1
Output at
end: 1

To workspace:
Size of
buffer: 1
Scilab variable
name: C
Inherit:
0

Definition of
  variable C in SciNotes upfront:
C.time=0;
C.values=0; 

Thank you in advance!


Mit
freundlichen Gren
Best
regards,

Michael
Ungelehrt




Michael
Ungelehrt, B.Eng.
Laboringenieur

THD 
Technische Hochschule Deggendorf
Technologie Campus Cham
Badstrae
21
D-93413
Cham

Tel:
+49 9971 99673-29
Fax:
+49 9971 99673-69
E-Mail:
michael.ungele...@th-deg.de
Web:
www.tc-cham.th-deg.de

  
  
  
  
  ___
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] Plotting density values

2014-02-25 Thread Serge Steer
The following function does the job but with one loop. It is based on 
the 1D classification function dsearch

Serg Steer


function occ=dsearch2D(xy,dx,dy,opt)
//x,y coordinates of the points of the cloud
//dx, discretization of the x axis
//dy , discretization of the y axis
//occ, table such as occ(i,j) contains the number of points in the
//pixel [dx(i) dx(i+1)) x [dy(j) dy(j+1))
  if argn(2)4 then opt='c';end
  if and(opt[c,d]) then
error(msprintf(_(%: unknown char specifier (must be ''c'' or 
''d'')\n),dsearch2D))

  end
  if size(xy,2)2 then
error(Wrong dimension for first argument)
  end
  [indx,occx]=dsearch(xy(:,1),dx,opt);
  occ=[];
  dy=matrix(dy,1,-1);
  for k=1:length(dx)-1
i=find(indx==k);
[indy,occy]=dsearch(xy(i,2),dy,opt);
occ=[occ; occy];
  end
endfunction




Le 25/02/2014 12:55, SCHULZ Wolfgang a écrit :

Hello,
I'm asking for an intelligent method to solve the following problem without a 
for loop.

I have 2 vectors x an y with e.g. 3000 values. The range of x values is between 
0 and 360 and the range of y values is between -15 and 15.
I would like to plot the density of individual grid cells for e.g. dx=10, dy=1 
and therefore I would need a matrix with 36x30 values where each value 
corresponds to the number of data points in the cell.

Any idea who I can do that without a for loop?

Thanks a lot
Wolfgang
___
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] evaluate error on each parameter calculated with leastsq

2014-02-20 Thread Serge Steer

Le 19/02/2014 14:31, Yohann a écrit :

Hi Antoine,
thank you for your answer but
what I need is a confidence interval on each parameter !
The confidence interval on the computed parameters depends on the 
confidence interval  on your x and y data.


In your case where you are looking for polynomial fitting then 
perturbations on y  produces perturbation on the computed parameters  
roughly proportionnal to the conditionning of the matrix A=[x*x x ones(x)]


if c is the mean square solution of the probleme for  y and c1 is the 
mean square solution of the problem of y1 then

norm(c-c1)/norm(c)=cond(A)*norm(y-y1)/norm(y)

x = [ 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6]';
y = [5.02  6.08  3.33 -0.93   -0.22  7.83  16.52 15.55  2.67 -11.42 -11.78 5.09 
25.25]';

A=[x.^2 x ones(x)];

y1=y;y1=y1.*(1+0.01*rand(y1));ey=norm(y-y1)/norm(y)
c1=A\y1;ec=norm(c-c1)/norm(c)

ec=cond(A)*ey

the dependance with respect to perturbation on x is more difficult.

Cheers
Yohann




--
View this message in context: 
http://mailinglists.scilab.org/evaluate-error-on-each-parameter-calculated-with-leastsq-tp4028696p4028742.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] Xcos PID controller problem

2014-02-18 Thread Serge Steer
The PID controller is an improper transfer function (degree of 
numdegree of den). In Xcos the derivative term of the PID bloc is 
computed by an approximation

which seems to fail in your context.

A solution should be to replace the PID bloc with a transfert function 
block made proper adding a very small term in s^2 for the denominator 
(sse the attched diagram)


Please report the problem in http://bugzilla.scilab.org/

Serge Steer

Le 17/02/2014 21:51, john a écrit :

Hello,
I'm new to Scilab and Xcos so may be making a simple mistake, but I have the
following problem.  I created an Xcos model of a simple mass-spring-damper
with PID control using the data from the Matlab example shown  here
http://ctms.engin.umich.edu/CTMS/index.php?example=Introductionsection=ControlPID
.

The Xcos results are the same as the Matlab example except for the case when
all three gains are used as follows Kp=350, Ki=300 and Kd=50 .

My result looks like this (red line) and is clearly giving a different
response to the Matlab example for the same gain values.
   http://mailinglists.scilab.org/file/n4028669/PID.png
I have tried different solvers and time steps, but this doesn't seem to be
the problem.  I have also modelled the problem in Mathcad 7, Mathcad Prime 3
and using csim in Scilab and all those results agree broadly with the Matlab
example.

Any advice would be greatly appreciated and I have attached the Xcos file
for information. spring-damper-PID.zcos
http://mailinglists.scilab.org/file/n4028669/spring-damper-PID.zcos




--
View this message in context: 
http://mailinglists.scilab.org/Xcos-PID-controller-problem-tp4028669.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





spring-damper-PID.zcos
Description: Binary data
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] How to get a reguar sampled vector in Scilab

2014-02-18 Thread Serge Steer
I think there is a little mistake in the sampledValues you are expecting:
 times = [0, 2, 6, 8, 14]
 values= [5, 9, 10, 1, 6]
sampledTime =   [0, 2, 4, 6,  8, 10, 12, 14]
sampledValues = [5, 9, 9, 10, 1,  1,  1, 6] 
According to the rule used for the previous values, the last value of 
sampledValues must be 1 and not 6

Here is a code doing what you expect (but with a different last point)
times = [0, 2, 6, 8, 14];
values= [5, 9, 10, 1, 6];

sampletimes=0:14;
V=zeros(sampletimes);
for k=1:size(times,'*')-1
  V(sampletimes=times(k)sampletimestimes(k+1))=values(k);
end
V(sampletimestimes($))=timesvalues($);
clf;plot(sampletimes,V,'-+')

//You can also use linear interpolation
V1=interpln([times;values],sampletimes);
plot(sampletimes,V1,'r-+')
//or Splin interpolation
V2=interp(sampletimes,times,values,splin(times,values))
plot(sampletimes,V2,'m-*')

Serge Steer
- Mail original -
 De: Matiasb mati...@gmail.com
 À: users@lists.scilab.org
 Envoyé: Mardi 18 Février 2014 20:59:10
 Objet: [Scilab-users] How to get a reguar sampled vector in Scilab
 
 I'm trying to program function (or even better it it already exists) in
 scilab that calculates a regular timed samples of values. IE: I have a
 vector 'values' which defines contains the value of a signal at different
 times. This times are in the vector 'times'. So at time times(N), the signal
 has value values(N). At the moment the times are not regular, so the
 variable 'times' and 'values' can look like:
 
 times = [0, 2, 6, 8, 14]
 values= [5, 9, 10, 1, 6]
 This represents that the signal had value 5 from second 0 to second 2. Value
 9 from second 2 to second 6, etc. Therefore, if I want to calculate the
 signal average value I can not just calculate the average of vector
 'values'. This is because for example the signal can be for a long time with
 the same value, but there will be only one value in the vector. One option
 is to take the deltaT to calculate the media, but I will also need to
 perform other calculations:average, etc.
 
 Other option is to create a function that given a deltaT, samples the time
 and values vectors to produce an equally spaced timeVector and corresponding
 values. For example, with deltaT=2 and the previous vectors,
 
 [sampledTime, sampledValues] = regularSample(times, values, 2)
 sampledTime = [0, 2, 4, 6, 8, 10, 12, 14]
 sampledValues = [5, 9, 9, 10, 1, 1, 1, 6]
 
 This is easy if deltaT is small enough to fit exactly with all the times. If
 the deltaT is bigger, then the average of values or some aproximation must
 be done...
 
 Is there anything already done in Scilab? How can this function be
 programmed?
 
 Thanks a lot! PS: I don't know if this is the correct forum to post scilab
 questions, so any pointer would also be useful.
 
 
 
 --
 View this message in context:
 http://mailinglists.scilab.org/How-to-get-a-reguar-sampled-vector-in-Scilab-tp4028712.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] Scilab vs Xcos

2014-02-14 Thread Serge Steer

Le 09/02/2014 16:14, noelec57 a écrit :

Bonjour

Je rejoins en tant qu'enseignant les utilisateurs de Scilab et Xcos. Pour le
moment j'essaie de l'utiliser pour la modélisation de systèmes asservis
continus avec PID. Je suis parvenu à obtenir la réponse de mon système en
utilisant Xcos (mode graphique) et scilab (ligne de code). Malheureusement
le même système étudié avec la même fonction de transfert ne fournit pas
exactement la même réponse. Par exemple, j'ai cherché le point d'instabilité
avec la méthode Ziegler Nichols. j'obtiens deux valeurs différentes de gain
critique. Idem, l'application d'un PID avec les mêmes valeurs ne fournit pas
la mêe réponse( variation d'environ 10% !!).

Je ne parviens pas à trouver la raison de cette différence.

A titre d'exemple, avec la fonction de transfert en BO suivante :  60 /
(1+8*s) * (1+2*s) * (1+s)

le système en BF à retour unitaire  provoque des oscillations stables dans
un cas avec un gain critique de 0,281 sous scilab et 0,287 sous xcos.
Vous ne dites pas comment vous avez obtenu ces deux valeurs. pour 
calculer la valeur du gain critique vous pouvez utiliser la fonction 
kpure de Scilab

h=60 /((1+8*%s) * (1+2*%s) * (1+%s));
Ki=kpure(h)  //-0.28125
//Vérification
H=(Ki*h) /.(1.0);
roots(H.den)

Si sous Xcos vous avez obtenu ce gain par simulation il faut savoir que 
l'integration numérique repose sur des tolérances. Dans xcos ces 
tolérances sont par défaut tolérantes. pour améliorer la précision des 
résultats vous devez spécifier des tolérance absolue et relatives plus 
strictes (menu: Simulation/Configurer)
  
Peut être que quelqu'un peut me dire, lequel des deux résultats je dois

prendre et surtout pourquoi cet écart ?

Merci.



--
View this message in context: 
http://mailinglists.scilab.org/Scilab-vs-Xcos-tp4028555.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] 3d curve plot

2014-02-13 Thread Serge Steer

Le 12/02/2014 12:49, Jeibros a écrit :

Hi all,

I'm totally new to Scilab (I used to work with Matlab), and I have a rather
simple question. I have two arrays (x,y). Next, I make a conversion so that
to get a new variable u out of x and y. And finally, I have a z,u
relationship.

*I would like to make a x,y,z plot*, and I don't need a surface, but a line.
Which is the solution please?

imagine that the code I have is this:

x=0:0.1:2;
y=0:0.2:4;
u=x+y;
z=3*u + 8;
plot3(x,y,z) //this is obviously wrong

Why?


Thanks a lot and sorry for the simple doubt




--
View this message in context: 
http://mailinglists.scilab.org/3d-curve-plot-tp4028615.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] bug report on http://wiki.scilab.org/howto/global%20and%20local%20variables

2014-01-28 Thread Serge Steer

Le 28/01/2014 17:14, Adrien Vogt-Schilb a écrit :

The page does not mention pause

Just because pause behave similarily to  functions with respect to 
calling context

http://wiki.scilab.org/howto/global%20and%20local%20variables

sorry, o busy to file a bug



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


Re: [Scilab-users] Strange list error

2014-01-27 Thread Serge Steer

Le 27/01/2014 19:05, Stefan Du Rietz a écrit :

Hello Paul,
after trying like a maniac ;-) I finally managed to reproduce it!

The error shows up only when you run the command from the command 
window after a pause in the attached function testlisterror.sci.


--testlisterror(pnonfast,nonfast)
-1-args(1) = null()
args(1) = null()
 !--error 44
Wrong argument #2.

Without the pause it works OK.

Regards
Stefan
Under pause, you cannot modify a variable which is defined in the 
calling context
so in such a context args is not a list as you expect but an empty array 
which is implicitely created


To make it work
you must do
-1- args; //makes a local copy of args
-1-args(1) = null()

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


Re: [Scilab-users] Transparent rectangle?

2014-01-20 Thread Serge Steer

Hi Antoine,

I understand that I could draw the lines after the coloured rectangle
to get them visible, but I cannot do that. So, I need the rectangle to
be transparent.


What do you mean by rearrange the order?


Here is an example
clf;
xpoly([0 1],[0,1]);p=gce();
xfrect([0.2 0.3 0.2 0.2]);r=gce();r.background=5;
swap_handles(p,r)

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


Re: [Scilab-users] Scaled plot displays in Scilab?

2014-01-09 Thread Serge Steer
You can proceed as follow. Note however that at least under windows it is not 
possible to create a window larger than the screen. 
Serge Steer 

clf;plot(linspace(0,100,10),linspace(0,150,10)) 

fig=gcf(); 
ax=gca(); 
ax.tight_limits=on; 
//Dimensions of the axis in user coordinates 
ax_xu=ax.data_bounds(2,1)-ax.data_bounds(1,1); 
ax_yu=ax.data_bounds(2,2)-ax.data_bounds(1,2); 
//pixel size in mm to be determined according to screen size and resolution 
px=0.33;//conversion pixel to mm 
py=0.35;//conversion pixel to mm 
//Dimension of the axis in pixels 
ax_xp=ax_xu/px; 
ax_yp=ax_yu/py; 
//Dimension of the current portion of the canvas in pixels 
ax_Wp=ax_xp/(1-sum(ax.margins(1:2))); 
ax_Hp=ax_yp/(1-sum(ax.margins(3:4))); 
//Canvas dimensions in pixels 
fig_Wp=ax_Wp/ax.axes_bounds(3); 
fig_Hp=ax_Hp/ax.axes_bounds(4); 
//Set fig.axes_size property to have 
fig.axes_size=[fig_Wp,fig_Hp]; 

- Mail original -

 De: Rafael Guerra jrafaelbgue...@hotmail.com
 À: International users mailing list for Scilab.
 users@lists.scilab.org
 Envoyé: Jeudi 9 Janvier 2014 16:46:04
 Objet: Re: [Scilab-users] Scaled plot displays in Scilab?

 Hi Stanislav,

 Thanks but it does not guarantee that the interval [x0,x0+10] will be
 plotted over 1 cm of the screen...
 I think that one may have to use a function like xchange but, more
 info about the physical screen is still required.

 Regards
 Rafael G.

 From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of
 ?
 Sent: Thursday, January 09, 2014 3:34 PM
 To: users@lists.scilab.org
 Subject: Re: [Scilab-users] Scaled plot displays in Scilab?

 Hello.
 You may divide x-axis by 1000. For example: plot2d(x ./ 1000, y);
 Also you may use a logarithm scale of x-axis.

 Stanislav
 09.01.2014 21:14, Rafael Guerra пишет:
  Hello,
 

  Does anyone know if it possible to generate scaled plots in Scilab?
 
  Say one wants to plot y=f(x), with x being a distance, at 1:1000
  scale (i.e., 1 cm on the PC screen would correspond to 10 m along
  x-variable). Scroll bar may be needed, if for given scale plot is
  larger than physical screen.
 

  Thanks for any hints.
 

  Best regards
 
  Rafael G.
 

  ___ 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] Put .txt data in matrix

2013-12-11 Thread Serge Steer

The fscanfMat function should do the job
Serge Steer
- Mail original -
 De: simon_37 simmar...@gmail.com
 À: users@lists.scilab.org
 Envoyé: Mercredi 11 Décembre 2013 16:12:48
 Objet: [Scilab-users] Put .txt data in matrix
 
 Hi everybody,
 
 I want to extract data from .txt in matrix for plot a graphic.
 Unfortunaly files .txt have some headers
 For example :
   Constante de temps : 2Nombre de cycles : 2
  ms
 Sensibilité : 100 microV
 Tension AC de lecture : 1.00E+3mV
 Fréquence AC de lecture : 3.70E+0kHz
 A min : -5.00E+0 V
 A max : 5.00E+0 V
 Pas de tension : 100.00E-3 V
 Durée totale du cycle : 150.00E+0 ms
 Durée de l'impulsion de tension : 150.00E+0 ms
 Commentaires : d:\labview\20131125_161108_LL072
 Informations sur la pointe :
 Colonnes 1 et 2 : X,Y de AIO, colonnes 3 et 4 : voies X,Y de AI1
 /end
 
 0.000 2.848   0.000   0.628
 0.100 2.535   0.100   0.733
 0.200 3.562   0.200   1.021
 0.300 3.111   0.300   0.620
 0.400 2.746   0.400   0.693
 0.500 2.739   0.500   0.860
 0.600 3.001   0.600   1.126
 0.700 2.306   0.700   0.967
 0.800 2.452   0.800   0.706
 0.900 2.551   0.900   1.046
 1.000 3.865   1.000   0.966
 1.100 2.161   1.100   0.987
 
 
 I already use the function read or functions mopen and mgetl and it
 doesn't
 work...
 I search the mean to begin the read at line number 15 of my file.
 I am trap.
 
 Regards
 Simon.
 
 
 
 
 --
 View this message in context:
 http://mailinglists.scilab.org/Put-txt-data-in-matrix-tp4028011.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] Write format

2013-11-09 Thread Serge Steer

Le 08/11/2013 19:47, eleo a écrit :

Hello,

How to write the format to export data (a vector v) in a file as a vector
line (56 rows, 1 column).
write(v.dat,v, FORMAT ?  )

something like
write(v.dat,v,(E15.8))
or
write(v.dat,v,(F15.8))
or
fd=mopen(v.dat,w)
mfprintf(fd,%f\n,v)
mclose(fd)

Serge Steer

Thank you.

Eleo



--
View this message in context: 
http://mailinglists.scilab.org/Write-format-tp4027803.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] loglog plot in 3d

2013-11-06 Thread Serge Steer
You can use
set(gca(),'log_flags','lln') to have the x and y axis in log mode and z in 
normal (linear) mode

Serge Steer

- Mail original -
 De: samaelkreutz mariajov...@icloud.com
 À: users@lists.scilab.org
 Envoyé: Mercredi 6 Novembre 2013 19:30:04
 Objet: [Scilab-users] loglog plot in 3d
 
 Hello everyone!!!
 
 Im working in an attenuation curve. So in my first plot is only a 2d
 version. And looks like:
 http://mailinglists.scilab.org/file/n4027785/loglog_test2.png
 
 So, now I have an extra challenge, add a third variable... this
 variable if
 the color of each cross in the first plot. My doubts are: ok i can
 plot
 the data in 3d but how can i keep the log log form?
 
 In my first plot i used those lines:
 
 J = DM(a,:);
 mag=J(:,2); // Magnitude [Mw]
 depth=J(:,3);//  [km]
 Dist=J(:,1) // [km]
 acc=J(:,4);// acceleration
 
 
 // Plot Log Log
 //scf(6);
 //clf(6);
 //plot2d(ll,Dist,acc,-1);
 //p.children.mark_mode = on;
 //p.children.mark_style = 9;
 //p.children.thickness = 3;
 //p.children.mark_foreground = 2;
 //xtitle(Loglog, Distance (km), Peak Ground Acceleration
 (m/s/s));
 set(gca(),grid,[10 10]);
 
 
 
 and now for my second version mag is my third  variable and gonna
 give the
 color. How can I do that???
 Please, please!!!
 I need help
 
 I'll be very thankful !!!
 
 
 
 
 
 
 
 
 
 
 --
 View this message in context:
 http://mailinglists.scilab.org/loglog-plot-in-3d-tp4027785.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] Scilab Xcos Datatips

2013-11-04 Thread Serge Steer

Le 31/10/2013 16:53, Alexander Weinig a écrit :


Dear Ms / Miss,

i have a question about using the datatips in Scilab's Xcos. I tried 
to simulate a PID-Controller and i want to use some datatips. My 
Problem is, that i need more decimal places for the Y-Axis. The 
problem is only if the datatip is over 1. It would be most helpful 
if there is a possibility to show the position of de datatip in a way 
like this for example: Y: 1.05 or Y: 1.005  it only shows Y: 1.1 
(not very)
Clicking right on a datatip open a gui where you can maodify the the 
function which generates the display

Serge Steer

For a better understanding look at the attechment.

Yours sincerely,
Alexander Weinig
alexander_wei...@yahoo.de



___
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 characters conversion

2013-10-21 Thread Serge Steer

You can use evstr for that
example
M=[1 2   5.54
3.45 8 -123
0   -432.512  -0.435]

--evstr(M)
 ans  =

1.  2. 5.54
3.458.   - 123.
0.- 432.512  - 0.435

Serge

Le 21/10/2013 14:29, Carrico, Paul a écrit :


Dear All

How can I convert a matrix of characters into integers when the 
separator has different number of spaces ?


The spaces come probably  from a printf format such as :
 printf(%10d\n,var)


I 'm currently using*_csvTextScan_*  and I've some troubles/errors  
with*_csvRead_*  ...

_Example_:

! 36 12799 24678 17504 21558212801 24680 
17508 21560 !


NB:

-I read first an ascii file

-I removed some specific lines directly in the matrix

-Then I'm trying to convert the matrix of characters into a matrix of 
intergers


Thanks for any suggestion

Paul

#

PATH_FILE  =  get_absolute_file_path(lecture.sce);  
FILE_NAME  =  'topology_elem.rad';
  
stacksize('max');  
M  =  mopen(PATH_FILE  +  /  +  FILE_NAME,'r');

record  =  mgetl(M);
[nl,nc]  =  size(record);
  
nbre_elem  =  (nl  /  3);

Nodes_char(1:nbre_elem)  =  record(1:3:nl);
  
/// convert/

Nodes  =  csvTextScan(Nodes_char,);/// 
!/
  
mclose(M)





Le présent mail et ses pièces jointes sont confidentiels et destinés à la 
personne ou aux personnes visée(s) ci-dessus. Si vous avez reçu cet e-mail par 
erreur, veuillez contacter immédiatement l'expéditeur et effacer le message de 
votre système. Toute divulgation, copie ou distribution de cet e-mail est 
strictement interdite.

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error, please contact the sender and delete the 
email from your system. If you are not the named addressee you should not 
disseminate, distribute or copy this email.



___
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] ode malfunction

2013-10-16 Thread Serge Steer
Take care that the ode  requires the function being at least  continuous 
and differentiable
If your input signal has singularities (points where it nos 
differentiable) you must stop the integration at this point and restart 
it just after taking the last state value as the intial point for the 
second run.


Serge Steer

Le 15/10/2013 17:46, Peter Hinow a écrit :

Dear fellows,

my goal is to solve numerically an ODE which contains a time-dependent 
parameter using 'ode'. I get a confusing result depending on whether the signal 
(it's called h) is on for 10 or 20 seconds. The two results are attached. 
Regardless of the model and the code, there should be a response in the 
variable w as soon as h switches from 0 to 1. I can provide any other 
information as needed.

Should I use bugzilla to report this? I am not doing this very often, so I need 
some instruction how to proceed.
Thank you and best regards,
   Peter



___
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-5.5.0-beta-1 crashes at startup

2013-10-02 Thread Serge Steer
For information, under SuSe12.3 on a 64 bits processor I obtain the following 
trace at startup 

peace% scilab-5.5.0-beta-1/bin/scilab 
scilab-bin: /tmp/scilab-5.5.0-beta-1/lib/thirdparty/libcurl.so.4: no version 
information available (required by 
/tmp/scilab-5.5.0-beta-1/lib/scilab/libscilab-cli.so.0) 
scilab-bin: /tmp/scilab-5.5.0-beta-1/lib/thirdparty/libcrypto.so.0.9.8: no 
version information available (required by 
/tmp/scilab-5.5.0-beta-1/lib/thirdparty/libcurl.so.4) 
scilab-bin: /tmp/scilab-5.5.0-beta-1/lib/thirdparty/libssl.so.0.9.8: no version 
information available (required by 
/tmp/scilab-5.5.0-beta-1/lib/thirdparty/libcurl.so.4) 
*** Error in `scilab-bin': free(): invalid pointer: 0x0068ac40 *** 
=== Backtrace: = 
/lib64/libc.so.6(+0x7abf6)[0x7fab3b3bebf6] 
/lib64/libc.so.6(+0x7b973)[0x7fab3b3bf973] 
/usr/lib64/gtk-2.0/2.10.0/engines/liboxygen-gtk.so(_ZN6Oxygen8GtkIconsC1Ev+0x973)[0x7faaf047c8a3]
 

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


Re: [Scilab-users] how to get list of object that are present in scilab script file

2013-09-03 Thread Serge Steer

Le 03/09/2013 12:20, hilife5 a écrit :

I want to know is there exist any way to get the list of objects like
variable names, matrices, plots that are present in scilab script file.
for script file, no but it is possible for functions using the macrovar 
function

Serge Steer


Thanks



--
View this message in context: 
http://mailinglists.scilab.org/how-to-get-list-of-object-that-are-present-in-scilab-script-file-tp4027336.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] scilab figure window toolbar icon remove

2013-07-29 Thread Serge Steer

You can use
toolbar(winnumber,'off')

but it hides all the tools of the toolbar

Serge
Le 27/07/2013 18:25, rajesh kannan a écrit :

hello,
I am using scilab for displaying a graph. Is there any way to remove 
selected icons from the tool bar. For example, if I want to remove 3d 
rotation, data tip and help icon, what should be done? I need sample 
codes also.



Thanks in advance


___
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


  1   2   >