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] 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] 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] 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] ?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-29 Thread Serge Steer

Le 29/10/2014 17:01, Tin Nguyen a écrit :

Thank you so much, Serge Steer!
Instead of finding a function like 'residuez' in Matlab, now I need to learn
many other things. It's not comfortable.
Hope Scilab will become more convenient for general users like me! :D
Take care that the Matlab function residuez does not produce exactly the 
same thing

first the residuez help pages states
"/Numerically, the partial fraction expansion of a ratio of polynomials 
is an ill-posed problem. If the denominator polynomial is near a 
polynomial with multiple roots, then small changes in the data, 
including roundoff errors, can cause arbitrarily large changes in the 
resulting poles and residues. You should use state-space (or pole-zero 
representations instead. /"
Moreover this function gives you the residual and you have to decide if 
some roots are equal or not, to be able to compute the fraction 
decomposition and this is not a simple thing to do.


If you  do something like
P=poly(ones(1,6),'x','r') //(x-1)^6
r=roots(P);
clf;plot(real(r),imag(r),'*')
You can observe that the roots are not exactly equal to one but located 
on a circle of radius approx %eps^(1/6)~=0.002


As noticed in the residuez help page *the problem is ill-posed*
to be convinced just compute the fraction decomposition of 1/(z-1)^6 
using residuez and computing back the fraction

>> [r,p,k]=residuez(1,poly(ones(1,6)));

>> [b,a]=residuez(r,p,k)
b =
   1.0e+07 *
  Columns 1 through 4
  -0.5038 + 0.0008i   2.5335 - 0.0041i  -5.0956 + 0.0081i   5.1243 - 
0.0081i

  Columns 5 through 6
  -2.5765 + 0.0040i   0.5182 - 0.0008i
a =
1.   -6.   15.  -20.   15.   -6. 1.


*The problem is ill-posed,* *so it should be better to avoid its use* . 
What is the problem you want to solve?

Serge Steer


-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Serge Steer
Sent: Thursday, October 23, 2014 2:22 AM
To: users@lists.scilab.org
Subject: Re: [Scilab-users] Problem with partial fraction decomposition
(dfss)

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

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] 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] frequency analysis of N variables

2014-12-02 Thread Serge Steer
Le 02/12/2014 09:09, David Chèze a écrit :
> Hi Serge,
>
> thanks it performs what I expect!
good
>  I wonder whether this function will be
> included in the next release of Scilab since it could be useful for lots of
> people as a general use case, not only dedicated to image processing. It
> might be also extended to N dimensions : should I add a ticket in the
> wishlist ?
please do
Serge
>
> Thanks,
>
> David
>
>
>
> --
> View this message in context: 
> http://mailinglists.scilab.org/frequency-analysis-of-N-variables-tp4031497p4031499.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" 
> À: 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" 
> À: 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] 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] 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" 
> À: 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] 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" 
> À: 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] 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] 2d plot y-axis expresio

2015-05-06 Thread Serge Steer
I am not sure to have understood exactly what you want to do but find below an 
example of what you can do

clf;plot(1:100)
ax=gca();//get the handle on the current axes
yt=ax.y_ticks; //get the ticks positions and labels
yt.locations=(0:20:100)';
yt.labels=msprintf("%.1f%%\n",yt.locations/10);
ax.y_ticks=yt;

Serge Steer
- Mail original -
> De: "fujimoto2005" 
> À: users@lists.scilab.org
> Envoyé: Mercredi 6 Mai 2015 15:10:15
> Objet: [Scilab-users] 2d plot y-axis expresio
> 
> I have an 2D-plot as the image.
> I wish to have the expresion of y-axis as follows.
> 1, %expression(0.05→5.0%)
> 2, tick should be 0.5%
> 3,If possible,the scale tick should be 0.1% but figure should be 0.5%  such
> as 4.5%,5.0%,5.5%..
> 
> Please Teach me how to fix them.
> 
> 
> <http://mailinglists.scilab.org/file/n4032213/question.png>
> 
> 
> 
> --
> View this message in context:
> http://mailinglists.scilab.org/2d-plot-y-axis-expresio-tp4032213.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] 2d plot y-axis expresio

2015-05-08 Thread Serge Steer

Le 07/05/2015 01:58, fujimoto2005 a écrit :

Thanks a lot.
1,I don't know well about c languge.please the meaning of 1st "%",

The first % opens the format, the .1 give the number of decimal digits

4th"f" and

f sands for floating point

last"%%" of "%.1f%%\n"

to display a % in a C format one should set 2 %


2,how to display only the range between 0.04 and 0.05 when
y=[0.01,0.03,0.041,0.042,0.05]?

clf;plot(y)
ax=gca();
yt=ax.y_ticks;
yt.locations=y';
yt.labels=msprintf("%.1f%%\n",100*y')
ax.y_ticks=yt;


3,how to display as the wider range like from 0.01 to 0.09 when
y=[0.01,0.03,0.041,0.042,0.05]?

ax.data_bounds(2,2)=0.09;

Serge Steer






--
View this message in context: 
http://mailinglists.scilab.org/2d-plot-y-axis-expresio-tp4032213p4032215.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] Functions to retrieve system configulation on Mac OS

2015-05-11 Thread Serge Steer
Le 10/05/2015 08:19, jaipur a écrit :
> There are functions to retrieve the specified system metric or system
> configuration setting as "getsystemmetrics" for Windows only in Windows
> tools.
I think the root_property function  is what you are looking for.

Serge Steer
> Is there alternative functions for Mac OS?
> Especially, I'd like to get screen size of the connected display to write my
> function to draw graph of proper size for all displays.
>
>
>
> --
> View this message in context: 
> http://mailinglists.scilab.org/Functions-to-retrieve-system-configulation-on-Mac-OS-tp403.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] linspace() generates error 21 - Invalid index.

2015-05-11 Thread Serge Steer
Le 11/05/2015 16:26, Piotr Grudzinski a écrit :
> Hello all,
>
> There is a file attached to this email to demonstrates the problem.
>
> The callback of the second button calls test_linspace() and there is no 
> problem.
>
> The callback of the first button calls rb_selected() which then calls
> test_linspace() and the following error is generated:
>
>
>  button 1
>  !--error 21
> Invalid index.
> at line  22 of function linspace called by :
> at line   2 of function test_linspace called by :
> at line   7 of function rb_selected called by :
> allbackobject(225);rb_selected(1);if exists("%oldgcbo") then gcbo
> while executing a callback
>
> Am I doing something wrong?
Your problem is due to the type function redefinition
the rb_selected function should be written as follow

function rb_selected(typ)
if (typ == 1) then
disp('button 1');
else
disp('button 2');
end
test_linspace();
endfunction

>
> Regards,
> Piotr
>
>
> ___
> 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] 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] ”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] 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  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] 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  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] 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
Le 27/05/2015 14:15, Vincent COUVERT a écrit :
> Hi all,
>
> What would you think about a feature describe as follows?
>
> We coud add a specific calling sequence for lines function (e.g
> lines(-1000)) that will switch automatically the display of Scilab to
> the "short" mode [1000x1000 constant] for a matrix (or hypermatrix)
> having a dimension greater that 1000.
>
I think using lines(-1000) or a similar solution is not a good solution
because as I said lines function does not rules the display of a single
variable, but the display of all output generated by an instruction

In my opinion it should be better to extend the format function adding
an optional argument or modifying the function to allow syntax like
format("type","v","digits",10,"max_lines",100)
format("max_lines",100)

Serge
> Regards.
>
> Le 27/05/2015 11:02, Serge Steer a écrit :
>> 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
>
> ___
> 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] eigs calculation

2015-06-18 Thread Serge Steer
Le 17/06/2015 22:18, Carrico, Paul a écrit :
> Dear All
>
> Thanks for the answers.
>
> To give more information's on what I'm doing (That's quite new I confess), 
> I'm performing  a (basic) finite element calculation with beams using sparse 
> matrix (stiffness matrix K and mass matrix M).
> [u,v] = 
> eigs(K((ddl_elem+1):$,(ddl_elem+1):$),M((ddl_elem+1):$,(ddl_elem+1):$),n,"SM");
>
> Nota: ddl means dof
>
> I'm calculated first the natural frequencies using (K - omega^2.M).x=0 ... 
> the pulse (or circular frequencies)  are no more and no less than the 
> eigenvalues of the above system (u = omega^2).
>
> Just a "mechanical" remark: since the beam is clamped in one side (and free 
> on the tip),  it is absolutely normal that you find twice the same natural 
> frequency (1rst mode in one direction, the second one in a new direction at 
> 90°)  I've been really surprised to find it, but happy at the same time 
> ...
>
> The origin of my question was: since it obvious that the results are strongly 
> sensitive to the "units" (i.e. the numbers), I'm wondering if there is a way 
> to control the accuracy of the eigenvalues calculation using eigs keywords 
> ... 
There is no way to improve accurary with an option. In general the
numerical algorithms try to return the best solution.
But it should be possible to improve accuracy by a well suited
normalisation (unit change for example!)

The condition number of u gives a measure of the numerical difficulty to
solve the problem


Note that as stated the eigenvalue computation may be a ill conditionned
problem in particular when there are clusters of eigenvalues

Please find below a little script which illustrate a typicall case
A=zeros(10,10)+diag(ones(1,9),1);A(10,1)=%eps;
s=spec(A);
clf;plot(real(s),imag(s),'+');

Serge Steer
> In any way, thanks for the debate
>
> Paul

___
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


Re: [Scilab-users] How to speed up making big structure?

2015-07-03 Thread Serge Steer
What are the types ans dimensions of  Field1,  Field2,  Field3 values?
This can help writing a efficient procedure.
Le 03/07/2015 09:42, jaipur a écrit :
> I'm making a big structure (about 110,000 items) by reading data from
> Hipparcos star catalog text file.
> My procedure is as follows.
>
> MyStruct = struct(); Index = 0;
> while ~meof(Fd) do
>  
>  
>  Index = Index + 1;
>  MyStruct(Index).  = ...;
>  MyStruct(Index).Field2 = ...;
>  MyStruct(Index).Field3 = ...;
> end
>
> But this procedure takes huge time!!
> The number of items is known. Could you teach me speedy way to make big
> structure?
> For example, keep memory for structure before starting like 
>
> MyVector = ones(11,1);
>
>
>
>
>
> --
> View this message in context: 
> http://mailinglists.scilab.org/How-to-speed-up-making-big-structure-tp4032530.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] 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] find function failure in scilab6

2015-09-01 Thread Serge Steer

Hello,

You forgot to attach the test.dat file.
But take care that two different values can give the same display.

To check it you can compute x(3)-y

Serge Steer
Le 01/09/2015 16:20, fujimoto2005 a écrit :
> Dear all.
> Save the attached file in current diorectry and run the following script.
> **
> load('test.dat');
> disp(x);//x contains 0.1 as the 3rd elemnt.
> disp(y);//y is 0.1
> z=find(x==y);
> disp(z)//failure because z returns [] instead 3.
>
> 
> Since x contains y as the 3rd element ,
> find(x==y) should return 3.
> But it returns [].
> Is there any error in my script or is this just a bug of scilab6?
>
> Best regards.
>
> filure_of_find_function.sce
> <http://mailinglists.scilab.org/file/n4032767/filure_of_find_function.sce>  
>
>
>
> --
> View this message in context: 
> http://mailinglists.scilab.org/find-function-failure-in-scilab6-tp4032767.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] 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] 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 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] 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 
>>> 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.polyl

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] 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" 
>>
>> .../... 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] 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] 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] Hypermatrix manipulation

2015-11-16 Thread Serge Steer

Le 16/11/2015 18:39, petarf a écrit :

Hi,

Could anyone help with storing data from a hypermatrix( M(x,y,z,k) ) to a
file. I would like to import this data to another software ( Gambit or
Pointwise).

Hypermatrix M consists only of numbers.
I do not know Gambit nor Pointwiseinput format,  but you can transform 
your hypermatrix to a 1D array using v=M(:) then write the vector and 
the dimensions in an ascii file using the mfprintf function


Nb V=[M(1,1,1,1);M(2,1,1,1);...M(1,2,1,1);M(2,2,1,1);... M(1,1,2,1);]

  Thank you for your help.
Best regards, Petar



--
View this message in context: 
http://mailinglists.scilab.org/Hypermatrix-manipulation-tp4033098.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] Title positioning on log-scale plots

2015-11-25 Thread Serge Steer

Le 25/11/2015 13:45, Antoine Monmayrant a écrit :

Le 11/25/2015 12:45 PM, Rafael Guerra a écrit :


Dear Scilaber’s,

Does anybody know how to [x,y]-position titles on log-scale plots?

See examples below which plot ok only if the x-scale is linear:

_clf_;

x=1:100;y=x.^0.2;

_subplot_(2,1,1)

plot2d(x,y,5,logflag="ln")/// changing to "nn" or "nl" works, but not 
"ll" or "ln"/


a=_gca_();

a.title.text="TITLE#1: out for lunch for logarithmic x-scale";

a.title.position=[min(x),max(y)+_stdev_(y)/3];

xgrid()

_subplot_(2,1,2)

plot2d(x,y,2,logflag="nn")

a=_gca_();

a.title.text="TITLE#2: OK for linear x-scale";

a.title.position=[min(x),max(y)+_stdev_(y)/3];

xgrid()

On a related matter, is it possible to use figure coordinates to 
position titles (instead of the axes coordinates)?


You can use xchange function to convert pixel coordinates to axes 
coordinates

Serge


Thanks and regards,

Rafael



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


Hi

is
a.title.auto_position="on"
ok for you?

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] 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] 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] 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] 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] 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] Font size adjustment of legend

2016-01-11 Thread Serge Steer

Here is an example
clf;
plot2d()
L=legend(["a","b","c"]);
L.font_size=5;


Serge Steer
Le 11/01/2016 17:31, Lester Anderson a écrit :

Hello,

I am having issues getting the font size to change for just the
legend. I have managed to alter the size for the axis and title. Also,
should both legend and legends work for the same task? I tried to use
legends and set the opt=4 (lower right position) and font_size=4, but
it did not seem to work.

Any pointers would be good (a basic query). The image shows the plot
so far and clearly there is room to make the legend bigger.

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

2016-02-23 Thread Serge Steer

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
Le 23/02/2016 12:21, grivet a écrit :

Hello,
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] 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] 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] 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-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] global constant definition for module

2016-03-02 Thread Serge Steer
In the past, it was possible to store variables in scilab libraries 
(lib) just saving them with the .bin extension and adding their names in 
the names file and so to do what you want.

example
dirpath=TMPDIR+"/test/";
mkdir(dirpath);
A=rand(5,5);
P=%s^2+1;
save( dirpath+"A.bin","A");
save( dirpath+"P.bin","P");
mputl(["A","P"],dirpath+"names");
testlib=lib(dirpath)
clear A P
//Up to this point every thing goes well

but with  5.5.2
A
return the error :Overloaded load cannot occur in this context

And I do not know if it is possible with Scilab6 because the bin files 
are no more "save" files.


I think it should be useful to make it work again
Serge


Le 02/03/2016 12:24, David Chèze a écrit :

Hi all,

I would like to define a variable in a user module in such a way that this
constant would be available for all functions (also out of the module) as a
"hidden(you don't need to see it inbrowsvar), protected (should not be
possible to clear it, even with clearglobal )" global variable as soon the
module is loaded: do you have suggestions how to do it within scilab?

David



--
View this message in context: 
http://mailinglists.scilab.org/global-constant-definition-for-module-tp4033598.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] global constant definition for module

2016-03-05 Thread Serge Steer

Le 05/03/2016 00:00, Samuel Gougeon a écrit :

Le 04/03/2016 23:33, Samuel Gougeon a écrit :

Le 02/03/2016 12:24, David Chèze a écrit :

Hi all,

I would like to define a variable in a user module in such a way that this
constant would be available for all functions (also out of the module) as a
"hidden(you don't need to see it inbrowsvar), protected (should not be
possible to clear it, even with clearglobal )" global variable as soon the
module is loaded: do you have suggestions how to do it within scilab?


There is still no actual solution to protect variables against clear.

.
Actually, there are one or two solutions :

 1.  Set and store your constants in a TCL session (the main one or a
slave), and recall them from it. Data in TCL sessions are not
cleared by clear() nor by clearglobal(). This is what i use in
drivers published on the fileexchange to set/get "persistent"
communication parameters with devices.
 2. May be the same could be possible with java objects? I have never
tried.
 3. Another solution is to use the userdata field of the default
figure. The default figure (gdf()) is not clearable. But then all
your graphic windows will embed your constants in their .userdata.
So it is preferable not to have MBytes of constantes ;) And to set
a struct() in userdata. This is a rather bad hacking.

May be there are other solutions. Let's free your imagination :)
Yes there is at least another one :-; : use the user_data field of an 
unvisible graphic window

fig=figure("visible","off","user_data",struct("A",123,"b","FOO"));

a=fig.user_data.A
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] 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] Model ID of First order delay and Dead Time Process

2016-03-10 Thread Serge Steer

Le 10/03/2016 14:42, noguchi a écrit :

Dear Mr.Serge,


Thank you for your information.

It works. Thanks.

May I have your advise on my question No.2 also?

2. Model ID
I would like to identify first or second order transfer function + dead time
from step test data (SISO).
for dead time, it is quite easy, just count the number of initial 
samples equal to zero
for transfer function idetification you can use the time_id or sident 
functions


Can we use subid and ss2tf?
I tf2ss command doesn't work for following transfer function with dead time.
No, it is not yet possible to manipulate continuous time state space 
representation  with delay. It is much more complicated due to state delays.




 1
h2d=exp(-5*s)*
2
  1 + 2s + 1s

-->tf2ss(h2d)
  !--error 59
出力引数の数が間違っています.
at line  14 of function tf2ss called by :
tf2ss(h2d)





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

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 rectan

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 in

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] 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] the name of a script

2016-03-16 Thread Serge Steer

Le 16/03/2016 09:23, Jan Åge Langeland a écrit :



On 16.03.2016 07:35, fujimoto2005 wrote:

Hi, all
Is there any ways to get the name of script when I am executing it ?
I want to write a code to get the name of the script containing that code.
For example , suppose I execute a script named with 'abc.sce'  and I want to
have a line which get the script name 'abc.sce' .

Best regards




a=gethistory();
b=strsplit(a($),  [filesep();]);
disp(b($-1));

This works if the script execution has been launched at the prompt 
level, but not if the script has been launched inside a function or an 
other script.


A solution is to use
 [units,typs,nams]=file()

This function return the property of all the files currently opened in 
the order they have been opened

so nams($) is what you are looking for:


Serge

JÅ


___
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] Optimization: First order delay and dead time TF model ID, CUTEr

2016-03-16 Thread Serge Steer

Le 16/03/2016 11:05, noguchi a écrit :

Hello, Scilab users,


I would like to do Model Identification using step test data with transport
delay.
First of all, I would like to identify the following parameters for SISO
case:

K, Tau, TD:   K/(Tau*s +1) * exp(-TD*s)

We have step test data, y (Process output) and U (process input).

Object function: Min ( (y-ymodel)^2)


I guess CUTEr can be used to solve this problem. I try to understand how to
use CUTEr using help file but failed.

If you are familiar with how to use CUTEr or other optimization command in
Scilab, could you please advise.

CUTEr is a tool designed for testing optimizers not for finding solution 
of optimization problems.


For solving optimization problems on can use the optim or fminsearch 
functions

Serge

Thanks.


Y. Noguchi



--
View this message in context: 
http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749.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] 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] 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] "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] "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] Set axes limit for plot

2016-04-28 Thread Serge Steer

Le 28/04/2016 08:19, Shamika Mohanan a écrit :

How do I set the minimum and maximum values for the axes in a plot?

When I use the plot command as

plot(x1,y1,x2,y2)

I get the plot where x axis is from 0 to 100 and y axis is from -20 to 
120. How do I set the axis from 25 to 100 for both x and y axes?


Shamika


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

after the plot you can do
ax=gca(),// gat the handle on the current axes
ax.data_bounds=[25 25;100 100];

Regards
___
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] 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] hypot

2016-08-30 Thread Serge Steer

Le 29/08/2016 à 18:43, Rafael Guerra a écrit :


Hi,

If I am not mistaken, that seems to be what Scilab vector “norm“ does.


You are right.
Serge Steer, INRIA


Regards,

Rafael

*From:*users [mailto:users-boun...@lists.scilab.org] *On Behalf Of 
*Claus Futtrup

*Sent:* Monday, August 29, 2016 6:40 PM
*To:* International users mailing list for Scilab. 


*Subject:* [Scilab-users] hypot

Hi all

In a text by Michael Baudin about Floating Points in Scilab:
forge.scilab.org/index.php/p/docscifloat/downloads/get/floatingpoint_v0.1.pdf
(David Goldberg is one of his references)

Here the special works of hypothenuses is further supported (page 
43-44 onward).


I wonder, does Scilab have the hypot function, similar to Matlab? ... 
Googling gives me no hits for Scilab but a page of hits with Matlab. 
For example http://blogs.mathworks.com/loren/2008/02/07/why-hypot/ 
<http://blogs.mathworks.com/loren/2008/02/07/why-hypot/>


P.S. Sorry for previously posting this question with a different 
subject. Stray thoughts were later modified but the subject line 
didn't have my attention.



/Claus



___
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] 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] 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] 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] 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
  nn=length(n

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, A=90,

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


<    1   2