Re: [Scilab-users] Can Scilab compute the inverse of the regularized Incomplete Beta Function?

2020-05-18 Thread Tim Wescott
So you have \beta(x, n+1, N+1-n) = 0.95, and you want to solve for x?

fsolve will do this for a single value of the confidence.  Is that
sufficient?

On Sun, 2020-05-17 at 23:49 +0200, Heinz Nabielek wrote:
> Dear SciLabers:
> 
> can Scilab compute the inverse of the regularized Incomplete Beta
> Function?
> 
> Example: in unbiased sampling in Austria with sample size N=1432,
> they detected n=1 infections.
> Therefore, expected infected fraction = 0.000698324.
> 
> But this does not say much, because the sample size was small and the
> "success" was extremely small (fortunately).
> 
> The standard procedure therefore is to derive the one-sided 95% upper
> confidence limit:
> CONF=0.95; N=1432; n=1:
> One-sided 95% upper confidence limit fraction = BETA.INV(CONF, n+1,
> N+1-n) = 0.003306121
> 
> How would I do that in Scilab?
> Heinz
> 
> ___
> 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


Re: [Scilab-users] Corona modelling

2020-03-30 Thread Tim Wescott
Someone was tagging "R" as "removed", which works if it's the aggregate
of "live and no longer contagious" and "dead".

Actually assessing the proportion of R depends on the local health
system, and, to some extent, the size of the peak -- the main reason
we're quarantining is to bring the peak down by broadening it.  The
percentage of 'R' that's dead people is going to depend on how burdened
the health care system is in any locality.

In cold-blooded mathematical terms it's just another dimension to the
modeling, but it's on the output side of the differential equation; it
doesn't have a great impact (as modeled) on the actual dynamics of
those three variables.

On Mon, 2020-03-30 at 17:12 +0300, Vesela Pasheva wrote:
> Hello colleagues,
> 
> I would like to know whether the variable D of dead persons could be 
> included in the model considered. Up till now the model considers
> the 
> variables S - susceptible, I - infected and R - recovered. Where do
> the 
> Dead persons D go.
> Of course i such case the system will be of four differential
> equations.
> 
> Best regards
> 
> Vesela
> 
> На 30-03-2020 15:38, Heinz Nabielek написа:
> > > On 30.03.2020, at 08:13, Stéphane Mottelet
> > >  wrote:
> > > Hello Heinz,
> > > 
> > > Here is an interactive version (made for my children last
> > > week...) :
> > > 
> > > // Confinement COVID-19 !
> > > // Stephane MOTTELET, UTC
> > > // Tue Mar 24 08:55:03 CET 2020
> > 
> > Great many thanks:
> > 
> > o The SIR model is great and can be readily understood.
> > 
> > o Scilab is great: one line of code where big EXCEL sheet produced
> > a
> > mess.
> > 
> > o Scilab friends and colleagues are great: instantaneous and real
> > help.
> > 
> > If the modelling is anywhere near to right, it will soon be over in
> > Austria (cyan circles are recorded infections). But this is likely
> > over-optimistic.
> > Heinz
> > 
> > __
> > Dr Heinz Nabielek
> > Schüttelstrasse 77A/11
> > A-1020 Wien, Österreich
> > Tel +43 1 276 56 13
> > cell +43 677 616 349 22
> > heinznabie...@me.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
-- 

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


Re: [Scilab-users] Corona modelling

2020-03-29 Thread Tim Wescott
This will be a straightforward application of the ODE solver.

Type "help ode" for more detail.

You'll make a function that takes the vector x = [S; I; R] as an
argument and returns [S'; I'; R'].  Then you'll call that function with
some starting x and let it play out.

You can speed up computation if you provide the Jacobian of f as a
function -- if you don't, the solver will calculate it at each time
step.

On Mon, 2020-03-30 at 02:14 +0200, Heinz Nabielek wrote:
> Colleagues:
> 
> is there an straightforward Scilab approach for solving the three
> coupled nonlinear differential equations of first order given by the
> Standard Model of Epidemics?
> 
> 
> S= number Susceptible:S'=-aSI
> I=  number Infected:  I'=aSI - bI
> R= number Recovered:  R'=bI
> whereby 'a' is the transmission coefficient, 'b' the recovery factor
> (after Reed-Frost 1928).
> Initial values for S, I, R are available.
> 
> Thank you
> Heinz
> ___
> 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


Re: [Scilab-users] a linear equation

2018-12-02 Thread Tim Wescott
Is there a reason not to do SVD, and throw out the singular values that
are too small?

On Sun, 2018-12-02 at 09:56 -0700, fujimoto2005 wrote:
> This problem is an economic problem. The i-th row of the square
> constraint
> matrix A with m dimension expresses certain economic constraints.
> The elements of the constraint matrix are either 0 or 1.
> Suppose the rank of A is r and by changing the row number a_1, ...,
> a_r are
> linearly independent. 
> I guess the coefficient cj (1 ≤ j ≤ r) in a_i = c1 * a_1 + ... cr *
> a_r for
> any m>=i> r is found to be 0, -1, 1 for some economic reasons.
> I would like to find such a_1, ..., a_r pairs.
> 
> The following matrix is the constraint matrix which I am dealing
> with.
> 
> A=zeros(27,27)
> 
> A(1,10)=1
> A(2,5)=1
> A(3,14)=1
> A(4,23)=1
> A(5,9)=1
> A(6,18)=1
> A(7,27)=1
> A(8,17)=1
> A(9,1)=0,A(9,18)=1
> A(10,2)=1,A(10,3)=1
> A(11,4)=1,A(11,5)=1,A(11,6)=1
> A(12,7)=1,A(12,8)=1,A(12,9)=1
> A(13,10)=1,A(13,11)=1,A(13,12)=1
> A(14,13)=1,A(14,14)=1,A(14,15)=1
> A(15,19)=1,A(15,20)=1,A(15,21)=1
> A(16,22)=1,A(16,23)=1,A(16,24)=1
> A(17,1)=0,A(17,25)=1,A(17,26)=1,A(17,27)=1
> A(18,4)=1,A(18,7)=1
> A(19,2)=1,A(19,5)=1,A(19,8)=1
> A(20,10)=1,A(20,13)=1,A(20,16)=1
> A(21,11)=1,A(21,14)=1,A(21,17)=1
> A(22,19)=1,A(22,22)=1,A(22,25)=1
> A(23,1)=0,A(23,20)=1,A(23,23)=1,A(23,26)=1
> A(24,4)=1,A(24,7)=1
> A(25,2)=1,A(25,5)=1,A(25,8)=1
> A(26,10)=1,A(26,13)=1,A(26,16)=1
> A(27,20)=1,A(27,23)=1,A(27,26)=1
> 
> Best regards.
> 
> 
> 
> --
> Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-
> Archives-f2602246.html
> ___
> 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


Re: [Scilab-users] Frequency response

2018-09-16 Thread Tim Wescott
I didn't answer about ZPK because I didn't know either!

It's not so much a Scilab thing as -- are you getting the signal
processing right?

On Sun, 2018-09-16 at 18:15 +0200, Claus Futtrup wrote:
> Hi Tim
> 
>  >So, this is complicated.
> 
> I admitted from the very beginning, it's probably just me that
> doesn't 
> know how to read the Scilab manual. It cannot be complicated for
> someone 
> who knows and/or understand the manual.
> 
> BTW, I also notice that nobody answered the question what ZPK means?
> ... 
> ZPK = Zagrepa Plivaci Klub ... at least the Scilab could spell out
> what 
> it stands for.
> 
> /Claus
> 
> On 15.09.2018 22:50, Tim Wescott wrote:
> > 
> > So, this is complicated.
> > 
> > First, if you have an impulse response, in the form of a vector of
> > samples, then you can turn it into a FIR filter, and you can find
> > the
> > frequency response of that with any of the available Scilab tools.
> >  I'm
> > not sure if there's a more direct way, but if you had an impulse
> > response h = [1, 1/2, 1/4, 1/8], then you can turn that into H = 1
> > +
> > 0.5*%z^(-1) + 0.25*%z^(-2) + 0.125*%z^(-3) (note that %z is a
> > built-in:
> > %z = poly(0, 'z')).  Then you can use techniques surrounding
> > repfreq to
> > get the frequency response.
> > 
> > Assign a sampling rate to it (i.e., by setting H.dt = 0.001, for a
> > 1kHz
> > sampling rate) and you can just use the Bode plot function:
> > bode(H).
> > 
> > Second, you can take your impulse response, pad it with zeros, and
> > then
> > take the FFT of it -- i.e. H = fft([h zeros(1, 252)]).  You need to
> > pad
> > it because the FFT is only exact for a periodic function in time --
> > padding it gives you an approximation of an actual impulse response
> > (and before someone jumps in and says you need to window it -- no,
> > you
> > don't, windowing is for sample vectors of continuous signals, not
> > impulse responses).  But if you don't know WHY the method is
> > approximate, you're going to have trouble correctly massaging the
> > data
> > before it's presented to the FFT, and with interpreting the
> > results.
> > 
> > On Sat, 2018-09-15 at 22:15 +0200, Claus Futtrup wrote:
> > > 
> > > Hi Samuel and Scilabers
> > > 
> > > My problem with freq and repfreq is that they require a "sys"
> > > input,
> > > which implies I need to describe a response function of some
> > > sort.
> > > For example (from the Scilab web-help):
> > > 
> > > https://help.scilab.org/docs/6.0.1/en_US/freq.html (example code)
> > > s=poly(0,'s');
> > > sys=(s+1)/(s^3-5*s+4)
> > > rep=freq(sys("num"),sys("den"),[0,0.9,1.1,2,3,10,20])
> > > 
> > > https://help.scilab.org/docs/6.0.1/en_US/repfreq.html (syntax)
> > > [ [frq,] repf]=repfreq(sys,fmin,fmax [,step])
> > > [ [frq,] repf]=repfreq(sys [,frq])
> > > [ frq,repf,splitf]=repfreq(sys,fmin,fmax [,step])
> > > [ frq,repf,splitf]=repfreq(sys [,frq])
> > > 
> > > ... So, the thing with the matlab freqz (as the example repeated
> > > below shows) is just a basic FFT with sampling, etc:
> > > 
> > > h = rand(1,64); // impulse response (Matlab source code)
> > > fs = 1000;
> > > Nfft = 128;
> > > [H,F] = freqz(h,1,Nfft,fs);
> > > semilogx(F,mag2db(abs(H))); grid on;
> > > xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
> > > 
> > > It may very well be that I just don't understand the help page of
> > > repfreq. For example it says about sys: "A siso or simo linear
> > > dynamical system, in state space, transfer function or zpk
> > > representations, in continuous or discrete time." - al right
> > > then, it
> > > seems pretty capable, but so, what's "zpk" for example? ... my
> > > apologies for finding the Scilab help to be cryptic and the
> > > examples
> > > insufficient for me to solve my problem, hence I ask if someone
> > > can
> > > take above matlab code and make it work in Scilab.
> > > 
> > > Best regards,
> > > Claus
> > > 
> > > On 15.09.2018 00:32, Samuel Gougeon wrote:
> > > > 
> > > > Le 14/09/2018 à 20:57, Claus Futtrup a écrit :
> > > > > 
> > > > > Dear Scilabers
> > > > > I have calculated an impulse response and wish to do an FFT
> > > > > to
> > > > > achieve 

Re: [Scilab-users] Frequency response

2018-09-15 Thread Tim Wescott
So, this is complicated.

First, if you have an impulse response, in the form of a vector of
samples, then you can turn it into a FIR filter, and you can find the
frequency response of that with any of the available Scilab tools.  I'm
not sure if there's a more direct way, but if you had an impulse
response h = [1, 1/2, 1/4, 1/8], then you can turn that into H = 1 +
0.5*%z^(-1) + 0.25*%z^(-2) + 0.125*%z^(-3) (note that %z is a built-in: 
%z = poly(0, 'z')).  Then you can use techniques surrounding repfreq to
get the frequency response.

Assign a sampling rate to it (i.e., by setting H.dt = 0.001, for a 1kHz
sampling rate) and you can just use the Bode plot function: bode(H).

Second, you can take your impulse response, pad it with zeros, and then
take the FFT of it -- i.e. H = fft([h zeros(1, 252)]).  You need to pad
it because the FFT is only exact for a periodic function in time --
padding it gives you an approximation of an actual impulse response
(and before someone jumps in and says you need to window it -- no, you
don't, windowing is for sample vectors of continuous signals, not
impulse responses).  But if you don't know WHY the method is
approximate, you're going to have trouble correctly massaging the data
before it's presented to the FFT, and with interpreting the results. 

On Sat, 2018-09-15 at 22:15 +0200, Claus Futtrup wrote:
> Hi Samuel and Scilabers
> 
> My problem with freq and repfreq is that they require a "sys" input,
> which implies I need to describe a response function of some sort.
> For example (from the Scilab web-help):
> 
> https://help.scilab.org/docs/6.0.1/en_US/freq.html (example code)
> s=poly(0,'s');
> sys=(s+1)/(s^3-5*s+4)
> rep=freq(sys("num"),sys("den"),[0,0.9,1.1,2,3,10,20])
> 
> https://help.scilab.org/docs/6.0.1/en_US/repfreq.html (syntax)
> [ [frq,] repf]=repfreq(sys,fmin,fmax [,step])
> [ [frq,] repf]=repfreq(sys [,frq])
> [ frq,repf,splitf]=repfreq(sys,fmin,fmax [,step])
> [ frq,repf,splitf]=repfreq(sys [,frq])
> 
> ... So, the thing with the matlab freqz (as the example repeated
> below shows) is just a basic FFT with sampling, etc:
> 
> h = rand(1,64); // impulse response (Matlab source code)
> fs = 1000;
> Nfft = 128;
> [H,F] = freqz(h,1,Nfft,fs);
> semilogx(F,mag2db(abs(H))); grid on;
> xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
> 
> It may very well be that I just don't understand the help page of
> repfreq. For example it says about sys: "A siso or simo linear
> dynamical system, in state space, transfer function or zpk
> representations, in continuous or discrete time." - al right then, it
> seems pretty capable, but so, what's "zpk" for example? ... my
> apologies for finding the Scilab help to be cryptic and the examples
> insufficient for me to solve my problem, hence I ask if someone can
> take above matlab code and make it work in Scilab.
> 
> Best regards,
> Claus
> 
> On 15.09.2018 00:32, Samuel Gougeon wrote:
> > Le 14/09/2018 à 20:57, Claus Futtrup a écrit :
> > > Dear Scilabers
> > > I have calculated an impulse response and wish to do an FFT to
> > > achieve the frequency response. I know what to expect. In the
> > > matlab forum someone asked the same question and was recommended
> > > to use freqz ... I wonder what would be the equivalent function
> > > in Scilab?
> > > https://www.mathworks.com/matlabcentral/answers/350350-how-to-plo
> > > t-loudspeaker-frequency-response-from-its-impulse-response
> > > For example, to replicate the code snippet (second answer in
> > > above link), how to do this in Scilab?
> > > h = rand(1,64); // impulse response (Matlab source code)
> > > fs = 1000;
> > > Nfft = 128;
> > > [H,F] = freqz(h,1,Nfft,fs);
> >  
> > Did you have a look around freq() or repfreq()?
> > 
> > We have somewhat the equivalence invfreqz(H,F,m,n,W)  <=> 
> > frfit(F*2*%pi, H, n, W) // Scilab
> > 
> > So you may look for the reciprocal of Scilab's frfit() 
> > 
> > HTH
> > Samuel
> > 
> > 
> > 
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
>   Virus-free. www.avast.com
>  ___
> 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


Re: [Scilab-users] ?==?utf-8?q? Both scilab 5.5.2 & 6.0 stopped working (java issue under linux)

2018-01-21 Thread Tim Wescott
Yes, but how can I have a clue as to what to set them _to_?

On Mon, 2017-12-04 at 16:05 +, Clément David wrote:
> Hi all,
> 
> Nice catch Antoine ! From my understanding of the crash and depending
> on your graphic card, you
> could switch the actual GL implementation to a well supported one
> rather than relying on the latest
> GL. For example, using mesa on my Intel i965 system, I can tweak the
> used Profile through
> MESA_GL_VERSION_OVERRIDE and MESA_EXTENSION_OVERRIDE [https://www.mes
> a3d.org/envvars.html].
> 
> Regards,
> 
> --
> Clément
> 
> Le lundi 04 décembre 2017 à 16:38 +0100, Antoine Monmayrant a écrit :
> > 
> > Hi all,
> > 
> > Answering my own post: it was a graphic driver issue, as usual.
> > I switch to another driver and now scilab starts, but all the
> > graphics windows are empty!
> > 
> > Antoine
> >  
> >  
> > On Monday, December 04, 2017 16:12 CET, "Antoine Monmayrant"  > a...@laas.fr> wrote: 
> >  
> > > 
> > > Hi everyone,
> > > 
> > > It seems that some automatic update have broken scilab on my
> > > linux station (16.04.3 64bits).
> > > Any java related feature is broken and only scilab-cli is
> > > working.
> > > As any of you any idea on how to investigate this issue?
> > > 
> > > Thanks in advance,
> > > 
> > > Antoine
> > > 
> > > PS: Here is the crash log:
> > > 
> > > 
> > > $ scilab
> > > Could not create a Scilab main class. Error:
> > > Exception in thread "main" java.lang.InternalError: XXX0
> > > profile[1]: GL3bc -> profileImpl GL4bc
> > > !!! not mapped 
> > > at
> > > com.jogamp.opengl.GLProfile.computeProfileMap(GLProfile.java:2071
> > > )
> > > at
> > > com.jogamp.opengl.GLProfile.initProfilesForDeviceCritical(GLProfi
> > > le.java:1954)
> > > at
> > > com.jogamp.opengl.GLProfile.initProfilesForDevice(GLProfile.java:
> > > 1875)
> > > at
> > > com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLProfi
> > > le.java:1842)
> > > at
> > > com.jogamp.opengl.GLProfile.access$000(GLProfile.java:80)
> > > at com.jogamp.opengl.GLProfile$1.run(GLProfile.java:230)
> > > at java.security.AccessController.doPrivileged(Native
> > > Method)
> > > at
> > > com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:216)
> > > at
> > > com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2297)
> > > at com.jogamp.opengl.GLProfile.get(GLProfile.java:988)
> > > at
> > > com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:722)
> > > at
> > > com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:733)
> > > at org.scilab.modules.gui.SwingView.(Unknown
> > > Source)
> > > at
> > > org.scilab.modules.gui.SwingView.registerSwingView(Unknown
> > > Source)
> > > at org.scilab.modules.core.Scilab.(Unknown Source)
> > > 
> > > Scilab cannot create Scilab Java Main-Class (we have not been
> > > able to find the main Scilab
> > > class. Check if the Scilab and thirdparty packages are
> > > available).
> > > 
> > > ___
> > > users mailing list
> > > users@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


Re: [Scilab-users] ?==?utf-8?q? Both scilab 5.5.2 & 6.0 stopped working (java issue under linux)

2018-01-21 Thread Tim Wescott
There's a known bug, at least in Ubuntu's bug base.

It appears to vary by hardware -- it doesn't work on this machine, but
it works on at least one of my laptops.

On Sat, 2018-01-20 at 08:45 +0100, antoine monmayrant wrote:
> I just noticed that I did not fill a bug report for that.
> I have 3 of my colleagues running Scilab on Ubuntu 17.04 /17.10 that
> are 
> also affected.
> Should I fill a bug report or it corresponds to a known one?
> 
> 
> Antoine
> 
> 
> Le 04/12/2017 à 17:05, Clément David a écrit :
> > 
> > Hi all,
> > 
> > Nice catch Antoine ! From my understanding of the crash and
> > depending on your graphic card, you
> > could switch the actual GL implementation to a well supported one
> > rather than relying on the latest
> > GL. For example, using mesa on my Intel i965 system, I can tweak
> > the used Profile through
> > MESA_GL_VERSION_OVERRIDE and MESA_EXTENSION_OVERRIDE [https://www.m
> > esa3d.org/envvars.html].
> > 
> > Regards,
> > 
> > --
> > Clément
> > 
> > Le lundi 04 décembre 2017 à 16:38 +0100, Antoine Monmayrant a écrit
> > :
> > > 
> > > Hi all,
> > > 
> > > Answering my own post: it was a graphic driver issue, as usual.
> > > I switch to another driver and now scilab starts, but all the
> > > graphics windows are empty!
> > > 
> > > Antoine
> > >   
> > >   
> > > On Monday, December 04, 2017 16:12 CET, "Antoine Monmayrant"  > > nm...@laas.fr> wrote:
> > >   
> > > > 
> > > > Hi everyone,
> > > > 
> > > > It seems that some automatic update have broken scilab on my
> > > > linux station (16.04.3 64bits).
> > > > Any java related feature is broken and only scilab-cli is
> > > > working.
> > > > As any of you any idea on how to investigate this issue?
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Antoine
> > > > 
> > > > PS: Here is the crash log:
> > > > 
> > > > 
> > > > $ scilab
> > > > Could not create a Scilab main class. Error:
> > > > Exception in thread "main" java.lang.InternalError: XXX0
> > > > profile[1]: GL3bc -> profileImpl GL4bc
> > > > !!! not mapped
> > > >  at
> > > > com.jogamp.opengl.GLProfile.computeProfileMap(GLProfile.java:20
> > > > 71)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.initProfilesForDeviceCritical(GLPro
> > > > file.java:1954)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.initProfilesForDevice(GLProfile.jav
> > > > a:1875)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLPro
> > > > file.java:1842)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.access$000(GLProfile.java:80)
> > > >  at
> > > > com.jogamp.opengl.GLProfile$1.run(GLProfile.java:230)
> > > >  at java.security.AccessController.doPrivileged(Native
> > > > Method)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:216)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2297)
> > > >  at com.jogamp.opengl.GLProfile.get(GLProfile.java:988)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:722)
> > > >  at
> > > > com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:733)
> > > >  at org.scilab.modules.gui.SwingView.(Unknown
> > > > Source)
> > > >  at
> > > > org.scilab.modules.gui.SwingView.registerSwingView(Unknown
> > > > Source)
> > > >  at org.scilab.modules.core.Scilab.(Unknown
> > > > Source)
> > > > 
> > > > Scilab cannot create Scilab Java Main-Class (we have not been
> > > > able to find the main Scilab
> > > > class. Check if the Scilab and thirdparty packages are
> > > > available).
> > > > 
> > > > ___
> > > > users mailing list
> > > > users@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
-- 

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


Re: [Scilab-users] Both scilab 5.5.2 & 6.0 stopped working (java issue under linux)

2018-01-21 Thread Tim Wescott
FYI:

https://askubuntu.com/questions/995093/after-latest-updates-scilab-5-5-
2-does-not-start-on-ubuntu-16-04-3-lts-amd64-a


On Mon, 2017-12-04 at 16:12 +0100, Antoine Monmayrant wrote:
> Hi everyone,
> 
> It seems that some automatic update have broken scilab on my linux
> station (16.04.3 64bits).
> Any java related feature is broken and only scilab-cli is working.
> As any of you any idea on how to investigate this issue?
> 
> Thanks in advance,
> 
> Antoine
> 
> PS: Here is the crash log:
> 
> 
> $ scilab
> Could not create a Scilab main class. Error:
> Exception in thread "main" java.lang.InternalError: XXX0 profile[1]:
> GL3bc -> profileImpl GL4bc !!! not mapped 
> at
> com.jogamp.opengl.GLProfile.computeProfileMap(GLProfile.java:2071)
> at
> com.jogamp.opengl.GLProfile.initProfilesForDeviceCritical(GLProfile.j
> ava:1954)
> at
> com.jogamp.opengl.GLProfile.initProfilesForDevice(GLProfile.java:1875
> )
> at
> com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.j
> ava:1842)
> at com.jogamp.opengl.GLProfile.access$000(GLProfile.java:80)
> at com.jogamp.opengl.GLProfile$1.run(GLProfile.java:230)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:216)
> at
> com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2297)
> at com.jogamp.opengl.GLProfile.get(GLProfile.java:988)
> at com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:722)
> at com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:733)
> at org.scilab.modules.gui.SwingView.(Unknown Source)
> at org.scilab.modules.gui.SwingView.registerSwingView(Unknown
> Source)
> at org.scilab.modules.core.Scilab.(Unknown Source)
> 
> Scilab cannot create Scilab Java Main-Class (we have not been able to
> find the main Scilab class. Check if the Scilab and thirdparty
> packages are available).
> 
> ___
> 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


Re: [Scilab-users] Scilab is crashing -- on one machine only

2017-06-28 Thread Tim Wescott
Thank you very much!  I missed that thread.  It's good to know what the
issue is.

Hopefully I can just wait it out -- if not, I know how to reboot with
an older kernel.

On Wed, 2017-06-28 at 11:09 +0300, Nikolay Strelkov wrote:
> Dear Tim!
> 
> As was discussed In the list ( http://mailinglists.scilab.org/Scilab-
> users-scilab-gt-Segmentation-fault-td4036624.html ).
> 
> This is not Scilab bug, it's bad attempt to fix CVE-2017-1000364
> security bug in Linux kernel.
> Debian 7, 8, 9; Ubuntu 14.04 LTS and 16.04 LTS are affected (seehttps
> ://bugs.launchpad.net/bugs/1699772).
> 
> The temporary solution is to reboot with previous kernel versions:
> * Debian 7 (wheezy): <= 3.2.78-1
> * Debian 8 (jessie): <= 3.16.43-2
> * Debian 9 (stretch): <= 4.9.30-2
> * Ubuntu 14.04 LTS (trusty): <= 3.13.0-119
> * Ubuntu 16.04 LTS (xenial): <= 4.4.0-79
> 
> Canonical and Debian will release normal kernel updates soon.
> 
> --
> With best regards,
> Ph.D., associate professor at MPEI,
> IEEE member,
> maintainer of Mathieu functions toolbox for Scilab,
> Nikolay Strelkov.
> 
> 28 июня 2017 г. 7:02 пользователь "Tim Wescott" <t...@wescottdesign.co
> m> написал:
> On one machine, Scilab crashes, with a segmentation fault.
> 
> On the other, it perks along happily.
> 
> The "bad" machine had the normal Ubuntu installation of Scilab
> (5.5.2),
> then I wiped that and installed 6.0.0 -- same thing.  I just
> reinstalled the Ubuntu version -- crashes.
> 
> scilab-cli works
> 
> The "good" machine is the same Ubuntu distro (16.04, 64-bit).
> 
> Any clues as to what may be happening?
> 
> --
> 
> 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
> 
-- 

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


[Scilab-users] Scilab is crashing -- on one machine only

2017-06-27 Thread Tim Wescott
On one machine, Scilab crashes, with a segmentation fault.

On the other, it perks along happily.

The "bad" machine had the normal Ubuntu installation of Scilab (5.5.2),
then I wiped that and installed 6.0.0 -- same thing.  I just
reinstalled the Ubuntu version -- crashes.

scilab-cli works

The "good" machine is the same Ubuntu distro (16.04, 64-bit).

Any clues as to what may be happening?

-- 

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


Re: [Scilab-users] linking (jumping) from line of code to an other

2017-05-12 Thread Tim Wescott
Jumps are generally bad style; I don't know if Scilab even supports
them.  If it does I advise you not to use them for something this
trivial (error handling is the only place I've seen them seriously
recommended, and even there they can be very problematical -- it's why
people invented exceptions).

For something that small the cost in making your code into spaghetti is
larger than the cost of just doing it.

The two ways that software professionals would deal with this are to
either get rid of 100 as a "magic number" and assign its value to a
variable (i.e., before the "for" statement assign PowerIncrement =
100), or rearrange the conditional so that the P = P + PowerIncrement
line is only encountered once.

Or do both.

Certainly if you use the existing structure and if the two lines that
increment P are supposed to do the same thing always, then using a
named variable is a Good Thing -- that means that at some later date,
when some poor ignorant fool reads your code they don't have to wonder
if the "P+100" in one spot means the same thing as the "P+100" in
another, AND they don't run the risk of changing the (hopefully proper)
increment in one place but not another.

And note, based on my experience writing software for the last 40
years, that often the poor ignorant fool who has to maintain your
software is you, months or years down the road -- so it pays to make
your code readable.  Nothing makes you feel dumber than not being able
to understand your own code, because no matter which way the blame
flies, it always lands squarely on you.

On Fri, 2017-05-12 at 11:15 +0200, Frieder Nikolaisen wrote:
> Hello,
> another question to solve the locomotive stuff, giving you a example
> with the not implented code. 
> I don't want to code the same stuff twice. Thats why I want to jump
> between lines of code. Is this possible and how? 
> P = 200;
> DM = 1;
> 
> for n = 1:10
> if DM == 1 then 
> if P > 100 then DM = 1
> P = P - 60
> disp('P bigger 100. DM = ' + string(DM))
> elseDM = 0
> P = P + 100 //instead of writing P = P +
> 100, I would like ...
> disp('P smaller 100. DM = ' + string(DM))
> end 
> else // D == 0 
> if P > 100 then DM = 1  
> disp('P bigger 100. DM = ' +
> string(DM))
> P = P - 30
> elseDM = 0  // ... to continue here 
> disp('P smaller 100. DM = ' +
> string(DM))
> P = P + 100   // to use this P = P + 100
> end
> end 
> disp(string(n) + ' ' + string(P))
> end
>  
> ___________
> 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


Re: [Scilab-users] Avoiding a loop

2017-05-11 Thread Tim Wescott
Depending on how often you switch between battery and generator, and
how icky-picky you're willing to be, there may be a way to reduce
computation.

It looks like the term P(n,2) * (P(n+1,1) - P(n,1)) is always there,
and you're either adding it to 'gen' (is it energy production?) or
subtracting it from 'batt'.

If you really want to go there, you can vectorize "if" statements by
using boolean expressions on vectors and the "find" function, which
returns indexes of true results.  Then you can use "cumsum" on your
P(n,2) * (P(n+1,1) - P(n,1)) term to find where the battery state of
charge (I assume that's what 'batt' is) hits 800.

It'll be complicated.  It'll be prone to error.  Proving that it's
correct will be a pain.  But when you get it working, it'll be
considerably faster.

On Thu, 2017-05-11 at 09:17 +0200, Frieder Nikolaisen wrote:
> Thanks for all the answers. 
> 
> I feared that there is no way around a loop. During the process batt
> (Battery) is charged and discharged. In my example, it is only
> discharged. I will code the entire problem with a loop, maybe
> somebody knows something to speed up the process with the full
> problem. (Tim: I am not a programming pro, a C-function might not be
> a solution. )
> Why do I try avoidng a loop? I do have txt-document with 50 000 to
> 100 000 lines about a (hybrid-)locomotive shunting process. I do need
> to optimize the energy managment. Because I am not mathemtic student,
> I have to solve the problem empirical (try and error). The programm
> has to run a few hundred times. With a matrix thats no problem, but
> with matrixes only, I can only calculate the diesel usage without any
> battery energy storage. 
> Thanks for the checking my code anyway. 
> 
> Am 10.05.2017 um 20:53 schrieb Amanda Osvaldo:
> > What it's the equation you need to compute ?
> > Perhaps I can help.
> > 
> > I think it's possible to compute with something in this way:
> > 
> > map = find (P(:,2) > 100 );
> > if batt > 800 then
> > batt = batt - P(map,2) * (P(map+1,1) - P(map,1));
> > end
> > 
> > 
> > On Wed, 2017-05-10 at 17:23 +0200, Frieder Nikolaisen wrote:
> > > Hello,
> > > I did write an example code, but I do not like the time consuming
> > > way I solved the problem. With 50 000 lines in the matrix, it
> > > wouldn't be fun.
> > > How can I avoid using the for-loop?
> > > 10, 80;
> > > 11, 200
> > > 15, 0];
> > > 
> > > batt = 1000;
> > > gen = 0;
> > > 
> > > n = 1
> > > for n=1:5
> > > 
> > > if P(n,2) > 100 then
> > > if batt > 800 then batt = batt - P(n,2) * (P(n+1,1) -
> > > P(n,1))
> > > else
> > > gen = gen + P(n,2) * (P(n+1,1) - P(n,1))
> > > end
> > > 
> > > else
> > > batt = batt - P(n,2) * (P(n+1,1) - P(n,1))
> > > end
> > > disp('n ' + string(n))
> > > disp('batt ' + string(batt))
> > > disp('gen ' + string(gen))
> > > end
> > > Thanks alot!
> > > 
> > > Best regards
> > > Frieder 
> > >  
> > > ___
> > > users mailing list
> > > users@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


Re: [Scilab-users] Evaluate external function for Couple ODE's

2017-05-03 Thread Tim Wescott
Read the help for feval.  It appears that feval(X, L, F17) would give
you a honkin' big square matrix of answers that are only valid along
the diagonal.  I think you just need to write a version of F17 that
understands getting X as a matrix and L as a vector.  If you've been
handed F17, you may need to write your own version of feval that loops
through the columns of X and values of L to give you a vector of
answers.

On Wed, 2017-05-03 at 10:43 -0700, tiagorleite wrote:
> Tim,
> 
> Thanks for your response.
> 
> X is my ODE solution vector for molar flow rates (Fi's), pressure (P)
> and
> temperature (T). L is my integration range. I don't know if you had a
> chance
> to check, but I have the code uploaded.
> 
> I will try your suggestion.
> 
> to evaluate the external function, would you use feval(X,L,F17)?
> 
> Thanks again!
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/Evaluate
> -external-function-for-Couple-ODE-s-tp4036287p4036296.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
> 
> 
-- 

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


Re: [Scilab-users] Evaluate external function for Couple ODE's

2017-05-03 Thread Tim Wescott
If your L and X vectors are what I think they are, and if your external
equations are what I think they are, then wouldn't each one's output
depend only on the value of one column of X and the corresponding value
of L?

So, vectorize them and call (e.g.) F18(X, L), or F18(X(:, 42), L(42)).

On Tue, 2017-05-02 at 20:21 -0700, tiagorleite wrote:
> First of all, sorry if this is a silly question. I am getting
> practice in
> Scilab
> 
> I have a set of 8 coupled ODEs and a set of 28 "external equations".
> 
> One example of external equation is my volumetric flow rate:
> 
> function v=F18(FE,FY,FH,FM,FP,FA,FL,FB,P,T)
> v=(v0*ro0)/F17()
> endfunction;
> 
> F17 is my density, which is depends on T, Pressure and total molar
> flow
> rate, and so on...
> 
> When I solve the coupled ODEs as: X=ode(Y0,L0,L,Y), where Y are my
> coupled
> ODEs vector, I get the values  for the variables of each differential
> equation.
> 
> My question is, how can I evaluate also the external functions?
> 
> I tried 'feval', but without success
> 
> Thank you!
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/Evaluate
> -external-function-for-Couple-ODE-s-tp4036287.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
> 
> 
-- 

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


Re: [Scilab-users] basic question ?

2017-04-23 Thread Tim Wescott
This is horrible, but should do what you intend:

B(i,1) = A(j + size(A, 1) * (k - 1));

It works because you can address a 2D matrix as a 1D matrix, with A(1)
== A(1, 1), A(2) = A(2, 1), A(size(A, 1) + 1) = A(1, 2), etc.

On Sun, 2017-04-23 at 22:25 +0200, paul.carr...@free.fr wrote:
> Hi All
> 
> I'm sorry if my question is "basic", but I've not understood why the
> following code does not work ... size of i,j,k seems correct
>  
> Do I miss something?
>  
> Thanks for your time
>  
> Paul
> 
> ##
> mode(0)
> 
> n = 10;
> 
> A = rand(n,6);
> B = zeros((2*n),2); C = B;
> 
> // goal is to get the value of the 1rst and 4th column in 2 lines
> i = [1 : (2*n)]';
> j = [1 : n]'.*.ones(2,1); // gives [1 1 2 2 3 3  n n]'
> k = ones(n,1).*.[1 4]';  // gives [1 4 1 4 1 4  1 4]'
> 
>  tmp = [i j k] // to visualize the indexes
> 
> //B(i,1) = A(j,k); // does not work??
> C(1,1) = A(1,1);
> C(2,1) = A(1,4);
> C
> A
> _______
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

Tim Wescott
www.wescottdesign.com
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


Re: [Scilab-users] Modelling dynamic systems with real world data

2017-04-11 Thread Tim Wescott
"Simulate the data"?

Surely you mean you wish to simulate the system which was used in the
measurement!

You don't give much detail, but I suspect that what you want to do is
to develop a model of the system that fits the experiment, and then use
that model in your simulations.

The general term for generating the model is called "system
identification", but that covers a pretty broad swath.

Can you share the test you did, the sort of data you collected, the
sort of system you're trying to model, and how well you know the system
itself?

On Tue, 2017-04-11 at 15:10 -0400, phillip mobley wrote:
> Hello all,
> 
> I have some data from a test that I preformed. I was looking to
> simulate this data under different conditions and I was wondering if
> there is a palette in xcos that would allow me to input data (maybe
> from an excel spreadsheet or copy paste) in order to use in the
> simulation?
> 
> Is this possible with xcos?
> ___
> 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


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread Tim Wescott
That doesn't show up in the help for 5.5.2.  Is it a 6.x thing, or is
there a toolbox?  Looks interesting, at any rate.

On Fri, 2017-03-24 at 18:45 +0100, CRETE Denis wrote:
> Hello !
> Did you try cshep2d + eval_cshep2d ?
> HTH
> Denis
>  
> [@@ THALES GROUP INTERNAL @@]
>  
> Unité Mixte de Physique CNRS / THALES
> 1 Avenue Augustin Fresnel
> 91767 Palaiseau CEDEx - France
> Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
> e-mail :
>  denis.cr...@thalesgroup.com <mailto:%20denis.cr...@thalesgroup.com>
> http://www.trt.thalesgroup.com/ump-cnrs-thales
> http://www.research.thalesgroup.com
>  
> De : users [mailto:users-boun...@lists.scilab.org] De la part de paul
> .carr...@free.fr
> Envoyé : vendredi 24 mars 2017 18:41
> À : User Scilab
> Objet : [Scilab-users] 3D interpolation
>  
> Hi all,
> 
> I don't know if my question is relavante (or not), but I'm wondering
> what is the best way to perform a 3D interpolation, from for the
> matrix definition to the interpolation procedure.
> 
> Let me using a basic example: I've some curves y = f(x,T) defining a
> material behaviour at different temperatures i.e. 1 curve (x,y) per
> temperature:
> - y = f(x,20)
> - y = f(x,100)
> - y = f(x,200)
> 
> etc.
> 
> What is the best way to define a single matrix? [x y T] ?
> 
> 
> Next step is to be able to perform a 3D interpolation whatever is the
> temperature (for a given x) ... any advice? (of course I'm looking to
> interp3D flag.
> 
> Thanks for any feedback
> 
> Paul
> _______
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

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


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread Tim Wescott
I'm not an expert.  But:

I did a quick spin through the help files and came up with splin2d and
interp2d.  It looks like what you want -- get the splines in x and T
using splin2d, and find the y values for a given x and T using
interp2d.

I don't know if this is the very best way to do this mathematically --
I know that this sort of 2D interpolated look-up is used extensively in
engine management units in cars (they're called "maps" in that lingo),
so there's probably a lot of research on accuracy vs. efficiency
tradeoffs.

On Fri, 2017-03-24 at 18:40 +0100, paul.carr...@free.fr wrote:
> Hi all,
> 
> I don't know if my question is relavante (or not), but I'm wondering
> what is the best way to perform a 3D interpolation, from for the
> matrix definition to the interpolation procedure.
> 
> Let me using a basic example: I've some curves y = f(x,T) defining a
> material behaviour at different temperatures i.e. 1 curve (x,y) per
> temperature:
> - y = f(x,20)
> - y = f(x,100)
> - y = f(x,200)
> 
> etc.
> 
> What is the best way to define a single matrix? [x y T] ?
> 
> 
> Next step is to be able to perform a 3D interpolation whatever is the
> temperature (for a given x) ... any advice? (of course I'm looking to
> interp3D flag.
> 
> Thanks for any feedback
> 
> Paul
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

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


Re: [Scilab-users] mixed data type matrix

2017-03-23 Thread Tim Wescott
On Thu, 2017-03-23 at 11:12 +0100, Jan Åge Langeland wrote:
> 
> On 23.03.2017 09:54, fujimoto2005 wrote:
> > 
> > I want to make the matrix whose the first column has the date value
> > such as
> > 2007/5/1 which I can use it in Excel and whose second column has
> > the
> > numerical value such as 0.12.
> > How can I construct such mixed data type matrix which I can copy it
> > and
> > paste it to Excel?
> > List is not a solution because I can copy it to the clipboard
> > through the
> > variable browser.
> > 
> Just convert the numerical value to a string:
> date=["2007/1/1" "2008/2/2" "2009/3/3"]'
> num=[1.1 2.2 3.3]'
> Mdn=date
> Mdn(:,2)=string(num)
> 
> Copy from variable browser or if you prefer, go via a csv file:
> 
> csvWrite(Mdn,"datafile.csv",";")

Or just write out a csv file.

Or, if it's a small enough data set, print it to the console, copy, and
paste into Excell.

-- 

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


Re: [Scilab-users] add number arrays efficiently, how?

2017-03-22 Thread Tim Wescott
On Thu, 2017-03-23 at 00:28 +0100, Samuel Gougeon wrote:
> Le 22/03/2017 à 23:15, Erhy a écrit :
> > 
> > Hello!
> > I'm thinking in arrays - and I write
> > 
> > SumArr = [ 1 2 3 ];  toAdd = [ 7 8 9 10 ];
> > SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) =
> > toAdd;
> > 
> > How to code it smarter?
> SumArr = [SumArr toAdd]
> 

If you know them in advance, yes.  My answer was predicated on not
knowing "toAdd" at the same time as the 1x3 SumArr.

> -- 

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


Re: [Scilab-users] add number arrays efficiently, how?

2017-03-22 Thread Tim Wescott
On Wed, 2017-03-22 at 15:15 -0700, Erhy wrote:
> Hello!
> I'm thinking in arrays - and I write
> 
> SumArr = [ 1 2 3 ];  toAdd = [ 7 8 9 10 ];
> SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) =
> toAdd;
> 
> How to code it smarter?

That's probably the best way to append an array if you can't anticipate
ahead of time how big your ending array will be.  However, each time
you do that Scilab has to allocate space for a bigger array, copy, and
destroy the old copy of the array.

If you DO know how big your ending array will be, then you can speed
things up by creating a zero array of full size, then populating it as
you go.  I.e., in this case you'd create SumArr to be 1x7, then
populate the first three elements, then populate the last four.

-- 

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


Re: [Scilab-users] Why there are Matlab explanation in Scilab Help?

2017-03-21 Thread Tim Wescott
Example?  "help XXX" that gets to the help page in question, perhaps?

Scilab has lots of hooks to allow you to convert and run Matlab
programs -- perhaps you've run into one of those?  I think there may
also be some pages that are designed to help people make the transition
from Matlab to Scilab.

On Tue, 2017-03-21 at 14:30 -0700, Erhy wrote:
> Hello!
> As newbie I ask you,
> why there are Matlab explanation in Scilab Help?
> Erhy
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/Why-ther
> e-are-Matlab-explanation-in-Scilab-Help-tp4035918.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
> 
> 
-- 

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


Re: [Scilab-users] Xcos - simulation problem with Backlash block

2017-03-21 Thread Tim Wescott
Can you post the Xcos file that causes the problem?

Backlash is very difficult to simulate.  The problem is what is known
as "stiff", meaning that there are places in the state space where the
linearized system suddenly changes its characteristics dramatically
over a small change in the values of the states.  In the case of
backlash, this happens when the backlash is taken up, and the output
suddenly starts moving in response to the input, where before it was
not connected.

This is a difficult problem for solvers -- hence, your solution is
taking more time.

I'd try all of the solvers available, and see if one works better than
another.  I'd start with the ones that have "BDF" in their names.  You
can choose the solver by clicking Simulation -> setup -> Solver kind.

On Mon, 2017-03-20 at 20:58 +0100, Tomasz Garstka wrote:
> Hello
> 
> I'm simulating in Xcos simple closed control loop (servo) with
> inertia
> block (1/1+Ts) as ramp function of drive. That's run OK. When I added
> Backlash block (to simulate real screw gear), the simulation take a
> long,
> long time without effect.
> If I remove inertia block, run OK, but no with both blocks.
> 
> How I can solve this problem?
> 
> Thank You
> 
> Tomasz
> 
> ___
> 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


Re: [Scilab-users] Read matrix from text file

2017-03-21 Thread Tim Wescott
Really Good Documentation is usually the last thing to get done even on
a commercial product -- there aren't many open-source software projects
that are well documented, and those are often documented separately in
how-to books.

Fortunately, we have things like mailing lists and forums.

The read function takes an optional format string, which, if you don't
provide anything, defaults to reading a line of numbers.  The
documentation says that it's in Fortran format, so you should be able
to find a good book or website on Fortran and find the format you need
to be able to read in a string or a set of strings.

On Tue, 2017-03-21 at 09:10 +0100, Frieder Nikolaisen wrote:
> Thanks alot. It also works with file and read for me. But I still
> don't know how to handle a string header: read: Wrong number of
> output argument(s): 0 expected.
> 
> Koeffizienten_DM=file("open",
> "C:\Users\f.nikolaisen\Documents\Bachelorarbeit\Simulation\Koeffizien
> ten_DM_Matrix.txt", "old")
> 
> E=read(Koeffizienten_DM,-1,4)
> 
> disp(E)
> 
> file('close',Koeffizienten_DM);
> 
> Could I still choose the document as a user? And having there not an
> abselout path, but the current directory opened.
> Sorry for this beginners questions, its really hard to get this
> details with the Scilab help.
> Greetings
> Frieder
>  
>  
> Am 2017-03-20 17:53, schrieb Tim Wescott:
> > On Mon, 2017-03-20 at 17:26 +0100, Frieder Nikolaisen wrote:
> > > Hello, I do try to read a matrix of floating point numbers from a
> > > text file. I want to have floating point numbers in Sciliab. (I
> > > used before mgetl which return strings). I have attached the
> > > example text file and scilab file. The error it says is: read:
> > > Wrong number of output argument(s): 0 expected. Thank you.
> > > Greetings Frieder   My code: Koeffizienten_Pfad =
> > > uigetfile(["*.txt"],'',"Wählen Sie die Datei Koeffizienten");
> > > Koeffizienten = mopen(Koeffizienten_Pfad) B =
> > > read(Koeffizienten,-1,4) disp(B) mclose('all')
> > Scilab has multiple contradictory ways of managing files.  It
> > appears
> > that "mopen" is not compatible with "read".  To use read:
> > 
> > -->file("open", "bob.txt", "old");
> >  
> > -->read(bob, -1, 4)
> >  ans  =
> >  
> > 1.2.3.4.  
> > 5.6.7.  - 8.  
> >  
> > -->file("close", bob);
> > 
> > However, if you can trust that your file will always be in a tidy
> > format, you can use fscanfMat:
> > 
> > -->fscanfMat("bob.txt")
> >  ans  =
> >  
> > 1.2.3.4.  
> > 5.6.7.  - 8.
> > 
> > (You can also use mopen and mfscanf -- the "file" stuff is
> > "Fortran-
> > like", the "mopen" stuff is "C-like", and fscanfMat is just
> > convenient.
> >  I tend to use the C-like stuff because most of my "real"
> > programming
> > work is done in C, so I'm familiar with it.  Pick your poison.)
>  
>  
> ___
> 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


Re: [Scilab-users] Read matrix from text file

2017-03-20 Thread Tim Wescott
You can use "Fortran style" ("file" to open and then "read"), or "C-
style" ("mopen" to open and then "mfscanf").  Both read and mfscanf let
you specify the number of lines to read in (note that I've only ever
done this with mfscanf).

You can also (I'm pretty sure) specify a number of lines to read with
mgetl -- this lets you read into a text block, then use whatever
parsing you want to actually read the data.

On Mon, 2017-03-20 at 19:13 +0100, Frieder Nikolaisen wrote:
> Hi Osvaldo, 
> thanks. It does run well. 
> I have different text documents, sometimes I want to skip the header
> or not load the entire document.  I do not find a solution in the
> help. Like with mgetl, just read a few lines as the variabale A and
> then use B for the wanted Matrix. 
> Cheers
> Frieder 
> 
> Am 20.03.2017 um 18:30 schrieb Osvaldo Sergio Farhat de Carvalho:
> > Hi Frieder,
> > 
> > Try
> > 
> > Koeffizienten_Pfad = uigetfile(["*.txt"],'',"Wählen Sie die Datei
> > Koeffizienten");
> > 
> > m = fscanfMat(Koeffizienten_Pfad)
> > 
> > disp(B)
> > 
> > Regards,
> > Osvaldo
> > 
> > -"users" <users-boun...@lists.scilab.org> escreveu: -
> > Para: <users@lists.scilab.org>
> > De: Frieder Nikolaisen 
> > Enviado por: "users" 
> > Data: 20/03/2017 01:37 PM
> > Assunto: [Scilab-users] Read matrix from text file
> > 
> > Hello,
> > I do try to read a matrix of floating point numbers from a text
> > file. I want to have floating point numbers in Sciliab. (I used
> > before mgetl which return strings).
> > I have attached the example text file and scilab file. The error it
> > says is: read: Wrong number of output argument(s): 0 expected.
> > Thank you.
> > Greetings
> > Frieder
> >  
> > My code:
> > Koeffizienten_Pfad = uigetfile(["*.txt"],'',"Wählen Sie die Datei
> > Koeffizienten");
> > 
> > Koeffizienten = mopen(Koeffizienten_Pfad)
> > 
> > B = read(Koeffizienten,-1,4)
> > 
> > disp(B)
> > 
> > mclose('all')
> > 
> >  
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> > 
> > 
> > [anexo "Dieselmotor_v2.0.sce" removido por Osvaldo Sergio Farhat de
> > Carvalho/PROF/DCC/ICEX/UFMG]
> > [anexo "Koeffizienten_DM_Matrix.txt" removido por Osvaldo Sergio
> > Farhat de Carvalho/PROF/DCC/ICEX/UFMG]
> > 
> > 
> > ___
> > users mailing list
> > users@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


Re: [Scilab-users] non linear optim

2017-03-20 Thread Tim Wescott
On Mon, 2017-03-20 at 08:53 -0700, David Chèze wrote:
> Hi Paul,
> 
> the leastsq examples run properly on my machine, as well as other
> tests with
> simple functions inside.
> 
> I looked at leastsq first because of the minimal request very simple
> way to
> express the problem f=costf(X) with functions that are not quickly
> vectorizable. Otherwise I was used to datafit. I saw in lsqrsolve
> that we
> need to provide the numbers of equations to run the solver, maybe
> it's
> similar for leastsq ? In my case the costf function evaluates the
> model over
> 7 tests, each test is 6 to 7 evaluations of different configurations.
> I'm
> limiting to 2 unknowns to calibrate in my model so the problem can be
> solve
> a priori  but leastsq is not informed of that a priori . 
> 
> and 
> 
> 

Hey David:

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

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

Looking at the relevant Wikipedia pages may suggest something:

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

-- 

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



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


Re: [Scilab-users] Read matrix from text file

2017-03-20 Thread Tim Wescott
On Mon, 2017-03-20 at 17:26 +0100, Frieder Nikolaisen wrote:
> Hello,
> I do try to read a matrix of floating point numbers from a text file.
> I want to have floating point numbers in Sciliab. (I used before
> mgetl which return strings).
> I have attached the example text file and scilab file. The error it
> says is: read: Wrong number of output argument(s): 0 expected.
> Thank you.
> Greetings
> Frieder
>  
> My code:
> Koeffizienten_Pfad = uigetfile(["*.txt"],'',"Wählen Sie die Datei
> Koeffizienten");
> 
> Koeffizienten = mopen(Koeffizienten_Pfad)
> 
> B = read(Koeffizienten,-1,4)
> 
> disp(B)
> 
> mclose('all')

Scilab has multiple contradictory ways of managing files.  It appears
that "mopen" is not compatible with "read".  To use read:

-->file("open", "bob.txt", "old");
 
-->read(bob, -1, 4)
 ans  =
 
1.2.3.4.  
5.6.7.  - 8.  
 
-->file("close", bob);

However, if you can trust that your file will always be in a tidy
format, you can use fscanfMat:

-->fscanfMat("bob.txt")
 ans  =
 
1.2.3.4.  
5.6.7.  - 8.

(You can also use mopen and mfscanf -- the "file" stuff is "Fortran-
like", the "mopen" stuff is "C-like", and fscanfMat is just convenient.
 I tend to use the C-like stuff because most of my "real" programming
work is done in C, so I'm familiar with it.  Pick your poison.)

-- 

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


Re: [Scilab-users] On parameters passing by name in scilab functions

2017-02-27 Thread Tim Wescott
You misread my comments.  Tim _likes_ named parameters.  If Tim were on
the C++ standards committee (which is as likely as pigs flying, BTW)
Tim would agitate that named parameters be adopted into that language.
 Scilab, Verilog, and (I think) VHDL have it, and particularly in a
language that allows for optional parameters, I feel that when you have
to have function calls with more than a few parameters it vastly aids
code readability.

On Mon, 2017-02-27 at 19:36 +0100, Samuel Gougeon wrote:
> Hello Adelson,
> 
> Le 27/02/2017 à 15:46, Adelson Oliveira a écrit :
> > Hi,
> > 
> > Let's take fft as an example.
> > 
> > In scilab 5 one could call fft specifying parameters like dim and
> > incr by name,
> > 
> > fft(A,-1,dim=100,incr=1)
>  Here names are simply ignored. There would be a true call by names
> if the order would not matter, while it does:
> -->Fp2 = fft(A,-1,incr=1,dim=100);
>    !--error 999 
> fftw: Wrong values for input argument #3: Elements must be greater
> than 1.
> 
> I guess that this is because fft() is a built-in, not a "macro".
> But even for functions written in Scilab language (aka macros),
> passing named parameters is strongly discouraged:
> this sets a formal link between the calling level and the inner
> called one. Then, any change of the parameters names in the function
> definition breaks such calls.
> the definition of most (say 99%) scilab functions test input
> parameters against their position rather than their name. It is not
> robust, but so it is. So (provided that fft() would be a macro) when
> calling fft(1,-1,incr=1), incr is detected at the third position
> while in the definition it is listed in the 4th one. Really efficient
> to get a mess ;)
> function test(a, b)
> mprintf("RHS=%d, exists(a)=%d  exists(b)=%d\n", argn(2),
> exists("a","l"), exists("b","l"))
> endfunction
> -->test(b=1)
> RHS=1, exists(a)=0  exists(b)=1
>  
> -->test(b=1,a=2)
> RHS=2, exists(a)=1  exists(b)=1
> So, Tim is right. Calls with named parameters make the code fragile,
> or make somewhat harder to code the analysis of input arguments in a
> robust way. This coding way still increases functions overheads, that
> make them slower.
> Samuel
> 
> ___
> 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


Re: [Scilab-users] On parameters passing by name in scilab functions

2017-02-27 Thread Tim Wescott
Is this true?  Parameter passing by name is hugely useful -- they'd
have to re-write a whole bunch of libraries to make it work, and I'd
have a lot of stuff that would be instantly obsolete.

On Mon, 2017-02-27 at 11:46 -0300, Adelson Oliveira wrote:
> Hi,
> 
> Let's take fft as an example.
> 
> In scilab 5 one could call fft specifying parameters like dim and
> incr by name,
> 
> fft(A,-1,dim=100,incr=1)
> 
> Codes that used to work in scilab 5 now gives wrong results (no error
> messages!) in scilab 6 because the new release ignores named
> parameters. To get expected results with scilab 6, one should recast
> the command above as,
> 
> fft(A,-1,100,1)
> 
> otherwise scilab 6 reads 
> 
> fft(A,-1)
> 
> instead!
> 
> What for ignoring parameter names? Also, I have some scilab codes
> where functions do accept names and take different actions
> accordingly. Should I 
> change all these codes to use scilab 6?
> 
> Thanks
> ___
> 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


Re: [Scilab-users] Bode of discret time transfer function.

2017-02-25 Thread Tim Wescott
Not sure what you're trying to achieve, but if you want a plot of the
linear amplitude response on a linear frequency line, use Horner:

H = syslin('d', (%z - 0.9) / (%z - 99));
th = %pi * (-1:0.01:1)';
clf; plot2d(th, abs(horner(H, exp(%i * th; xgrid(2)

On Sat, 2017-02-25 at 18:17 +, Pablo Fonovich wrote:
> 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.
> 
> Any hints would be appreciated.
> Thanks
> ___
> 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


Re: [Scilab-users] Bode of discret time transfer function.

2017-02-25 Thread Tim Wescott
First, 'bode' is going to give you a Bode plot, and it's going to be
insistent on giving it to you in log-log format -- so if you want a
plot on a linear frequency axis from -pi to +pi, then you need to do it
by hand.
Second, 'bode' is pretty insistent about reporting things as per second
-- if you define a system as 'd' then it'll act like the system is
sampled at 1Hz.
If, for instance, you run:
H = syslin('d', (%z - 0.9) / (%z - 1));
g = scf(0); clf; bode(H, 0.001, 0.4999, 'rad')
You will get the following plot:
It puts the vertical red lines there, presumably to mark Nyquist, even
though we're displaying in radians per sample, and it reports things as
radians/s.  You can get into the guts of the graph and fix it up,
though:
delete(g.children(2).children(1));   // Delete the top red line
delete(g.children(1).children(1));   // Delete the bottom red line
g.children(2).x_label.text = "Frequency (rad/sample)";  // Change the
top text
g.children(1).x_label.text = "Frequency (rad/sample)";  // change the
bottom text
Do all this, and you get:
On Sat, 2017-02-25 at 20:38 +0100, Serge Steer wrote:
> 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
-- 

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


Re: [Scilab-users] function with public variables possible?

2017-02-10 Thread Tim Wescott
Sorry -- just re-read your question and realized what you actually
meant.

I just double-checked this -- if you hit a breakpoint inside a
function, the variable browser shows that functions variables.  Once
you exit the function, the variables that only exist within the
function disappear.

On Fri, 2017-02-10 at 07:48 -0700, Erhy wrote:
> Hello!
> In may first exercises with SCILab functions I was disappointed that
> I cannot see the variables declared and used in the function with
> Variable
> Browser.
> 
> I tried the global statement, but I cannot browse the global
> variables in
> the usual way.
> 
> Is there a way to have all variables public?
> 
> Thank you
> Erhy
> 
> 
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/function
> -with-public-variables-possible-tp4035458.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
> 
> 
-- 

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


Re: [Scilab-users] function with public variables possible?

2017-02-10 Thread Tim Wescott
What exactly do you want?

Are you trying to modify global variables from within a function?

Are you trying to pass values from the function to the outside world?

Are you trying to use (but not modify) global variables from within a
function?

Or do you disagree with the way that the variable browser displays
variables?

On Fri, 2017-02-10 at 07:48 -0700, Erhy wrote:
> Hello!
> In may first exercises with SCILab functions I was disappointed that
> I cannot see the variables declared and used in the function with
> Variable
> Browser.
> 
> I tried the global statement, but I cannot browse the global
> variables in
> the usual way.
> 
> Is there a way to have all variables public?
> 
> Thank you
> Erhy
> 
> 
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/function
> -with-public-variables-possible-tp4035458.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
> 
> 
-- 

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


Re: [Scilab-users] Interfacing to third party DLLs

2017-01-07 Thread Tim Wescott
On Sat, 2017-01-07 at 22:01 +, James Holland wrote:
> I'm new to Scilab but I have some experience with MATLAB. I'm trying
> to port some code that calls functions in a third party DLL. From
> what I've read I can't do this if the function returns a value
> however that article was a couple of years old, is there now an
> equivalent of loadlibrary? I have seen comments referring to the
> API_Scilab but that seems to be only for calling Scilab functions.
> TYI
> James 
> 

I don't know if there's a better way, but you could always write C
functions using the Scilab API that talk to the DLL.

It'd be a pain, and it would be nice if someone would make it more 
painless.  But -- the possibility is there.

--

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


Re: [Scilab-users] Printf on console in a c file

2016-12-20 Thread Tim Wescott
On Tue, 2016-12-20 at 15:02 +0100, Perrichon wrote:
> Hello,
>  
> I’d like to print in a C file (inside a palette) on the console, but
> nothing appends.
> Have anybody an idea on how to proceed ?
>  
> I’ve also try something  like :
> fprintf(stderr,"\n Lower limiter greater then Upper one");
> but I get errors at compile time, includind stdio.h

Are you trying to use the C standard library printf, or the Scilab
printf?

It's been a while since I've done combined C and Scilab code, but if I
remember correctly you can call Scilab functions from C -- that's
probably what you'll need to do.

-- 

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


Re: [Scilab-users] xtitle seems to suppress plot

2016-11-27 Thread Tim Wescott
Over and over, it works every time.

Maybe file a bug report?

On Sun, 2016-11-27 at 23:11 +0100, Jens Simon Strom wrote:
> Hallo Tim,
> It may be of interest that the script works when it is  executed
> directly after start of Scilab. All further runs fail - reproducibly.
> Tim, would you be so kind to run the script twice on your
> installation.
>  Cheers
> Jens
> 
> Am 27.11.2016 19:41, schrieb Jens Simon Strom:
> 
> > I use scilab-5.5.2. 
> > I just tried 5.4.0. There the script works.
> > Cheers
> > Jens
> > ----------
> > 
> > 
> > 
> > Am 27.11.2016 19:00, schrieb Tim Wescott:
> > 
> > > On Sun, 2016-11-27 at 18:06 +0100, Jens Simon Strom wrote:
> > > > Hallo,
> > > > Instead of drawlater/drawnow I prefer the below approach for starting
> > > > a figure because no  windows flicker temporarily on the screen. This
> > > > works fine exept when 'xtitle' is used.  Inspecting the figure's,
> > > > axes', compound's  and polyline's data I get no hint that the axes
> > > > should be invisible. How can I make the axes appear without initial
> > > > flicker?
> > > > xdel(); 
> > > > cf=figure("immediate_drawing",'off', 'visible','off');
> > > > plot(rand(1,5))
> > > > sleep(1000)//only for checking invisibility of new figure
> > > > cf.immediate_drawing="on";  cf.visible="on"; 
> > > > //xtitle('xtitle seems to suppress plot content.')
> > > > Cheers
> > > > Jens
> > > Works fine for me; Scilab 5.5.0 on Ubuntu 14.04.  Background is weird,
> > > though.
> > > 
> > > -->getversion
> > >  ans  =
> > >  
> > >  scilab-5.5.0   
> > >  
> > > 
> > > 
> > > ___
> > > 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


Re: [Scilab-users] xtitle seems to suppress plot

2016-11-27 Thread Tim Wescott
On Sun, 2016-11-27 at 18:06 +0100, Jens Simon Strom wrote:
> Hallo,
> Instead of drawlater/drawnow I prefer the below approach for starting
> a figure because no  windows flicker temporarily on the screen. This
> works fine exept when 'xtitle' is used.  Inspecting the figure's,
> axes', compound's  and polyline's data I get no hint that the axes
> should be invisible. How can I make the axes appear without initial
> flicker?
> xdel(); 
> cf=figure("immediate_drawing",'off', 'visible','off');
> plot(rand(1,5))
> sleep(1000)//only for checking invisibility of new figure
> cf.immediate_drawing="on";  cf.visible="on"; 
> //xtitle('xtitle seems to suppress plot content.')
> Cheers
> Jens

Works fine for me; Scilab 5.5.0 on Ubuntu 14.04.  Background is weird,
though.

-->getversion
 ans  =
 
 scilab-5.5.0   
 
-- 

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


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

2016-11-23 Thread Tim Wescott
Out of curiosity, how does that relate to pfss?

On Wed, 2016-11-23 at 23:30 +0100, Samuel Gougeon wrote:
> Le 23/11/2016 23:19, philippe a écrit :
> > .../...
> > Le 23/11/2016 à 20:08, Tim Wescott a écrit :
> >
> >> [...]
> >> Just as a note: I'm not sure what physical processes you're trying to
> >> represent with ratios of polynomials,
> >
> > I'm working on partial fraction decomposition  algorithms.
> .
> Like there?:
> https://fileexchange.scilab.org/toolboxes/451000
> 
> See also 
> http://mailinglists.scilab.org/Users-fr-Racines-multiples-d-un-polynome-tt4032750.html
> 
> Cheers
> Samuel
> 
> ___
> 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


Re: [Scilab-users] Start an arrested loop with one keystroke only

2016-11-21 Thread Tim Wescott
xclick()

On Mon, 2016-11-21 at 17:22 -0700, Jens wrote:
> Hallo Scilab users,
> I am searching for a convenient way to  restart a loop with only *one* key
> or mouse stroke. The loop may generate and show graphics or not. I tried
> xclick, pause, halt, and input with little success. input is closest to the
> target but not close enough. 
> 
>for i=1:3
>   plot()
>   //commands wanted which stops the loop and continues it with ONE key
> or mouse stroke only.
>   //input('click on console and press return')// very close but more
> than one stroke
>   xdel();
>   end
> 
> 
> 
> --
> View this message in context: 
> http://mailinglists.scilab.org/Start-an-arrested-loop-with-one-keystroke-only-tp4035053.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
> 
> 

-- 

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


Re: [Scilab-users] Understanding the graphic hierarchy. Copy a figure

2016-11-21 Thread Tim Wescott
I believe that Samuel is objecting to you starting a new topic by
replying to an existing email and then changing its title and subject.
When you do that, you end up with a bunch of different topics all in one
thread.

So -- for a new topic, start a new email.

On Mon, 2016-11-21 at 23:10 +0100, Jens Simon Strom wrote:
> Hi Samuel,
> I'm sorry for opening  threads in a blotted manner. My practice up to 
> now was to send an email with a (hopefully) meaningful headline to 
> <users@lists.scilab.org>. I just learn that this is bad practice and I 
> will endeavour to find out the correct approach. If I get to nothing I 
> will request a clue under this subject and hope for pardon.
> Regards
> Jens
> -
> Am 21.11.2016 20:46, schrieb Samuel Gougeon:
> > Le 21/11/2016 18:10, Jens Simon Strom a écrit :
> >> Hallo Samuel,
> >> This is refreshing straightforward. Problem solved!
> > Glad to read it.
> > Please note i will no longer contribute answering to you as long as 
> > you will keep branching unrelated threads instead of opening new ones. 
> > Sorry, but this is really a bad practice.
> >
> > 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

-- 

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


Re: [Scilab-users] Lack of Scatter type plots in scilab

2016-11-15 Thread Tim Wescott
If you just want to do an ordinary scatter plot, set the line style to a
negative number in your plot2d call:

-->x = (-5:5)' + rand(11, 1, "n");

-->y = m * x + x_0 + rand(11, 1, "n");
 
-->b = [ones(x) x] \ y;
 
-->clf; plot2d(x, y, style = -2); plot2d([-5; 5], [1 -5; 1 5] * b)

As with continuous lines you can set different styles, but instead of
getting different colored lines you'll get different shapes (squares,
circles, pluses, etc.)

Did this help?

On Mon, 2016-11-14 at 14:37 -0600, n.gulunay wrote:
> Nobody responded to this message. May be I addressed it wrongly.
>  Is there a seperate email address such requests should be sent to?
> 
> 
> 
> 
> 
> 
>  Original message 
> From: "n.gulunay" <n.gulu...@gmail.com> 
> Date: 11/12/16 8:14 AM (GMT-06:00) 
> To: Users mailing list for Scilab <users@lists.scilab.org> 
> Subject: Re: [Scilab-users] Facet color in Vers. 5.5.2 
> 
> Hi Rafael,
> Jens's question reminds me the grayplot problem that you helped me
> with.
>  If you recall I went though all that gymnastics to create a proper
> set of Inputs like you are describing here. Why doesnt scilab have
> option of coding scatter type input ( that is x,y and z all are
> vectors of the same size ) for all these plotting utilities? That will
> be a good service to the user community. 
> 
> 
> 
> 
> 
> 
> Sent via the Samsung GALAXY S® 5, an AT 4G LTE smartphone
> 
> 
>  Original message 
> From: Rafael Guerra <jrafaelbgue...@hotmail.com> 
> Date: 11/12/16 6:49 AM (GMT-06:00) 
> To: Users mailing list for Scilab <users@lists.scilab.org> 
> Subject: Re: [Scilab-users] Facet color in Vers. 5.5.2 
> 
> Hi Jens,
> 
>  
> 
> You need a proper input to plot3d (x and y monotonous with length n1
> and n2, and z with size n1 x n2):
> 
>  
> 
> clear;clf();
> 
> plot3d([01],[01],[00;00])
> 
> ce=gce();
> 
> ce.color_flag=0;
> 
> ce.color_mode=5; // 5 = red; 1 = black
> 
>  
> 
> Regards,
> 
> Rafael
> 
>  
> 
> From: users [mailto:users-boun...@lists.scilab.org] On Behalf OfJens
> Simon Strom
> Sent: Saturday, November 12, 2016 12:00 PM
> To: Users mailing list for Scilab <users@lists.scilab.org>
> Subject: [Scilab-users] Facet color in Vers. 5.5.2
> 
> 
>  
> 
> Hi Scilab experts,
> please help me to get the facet black, not cyan. 
> 
> plot3d([0 1 1 0]',[0 0 1 1 ]',[0 0 0 0]')
> ce=gce();
> ce.color_flag=0;// Help page says: "All facets are painted using the
> color index and method defined by color_mode"
> ce.color_mode=1//Help page says: "The color of the facet when
> color_flag value is 0" Index 1 should produce Black, but CYAN is
> delivered.
> //getcolor
> 
> Regards
> Jens
> 
> 
> ___
> 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


Re: [Scilab-users] Ubuntu upgrade just killed GL

2016-11-10 Thread Tim Wescott
I've got my problems sorted -- the saga is in the link below.  In the
end, it seems to only relate to Scilab because Scilab uses OpenGL.

I suspect it's some peculiar corner case involving my combination of
software and hardware.

https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-331/+bug/1639371

On Thu, 2016-11-10 at 12:13 +0100, Clément David wrote:
> Hello Tim,
> 
> Thanks for the report, FYI I checked a Scilab 6 local build and a Scilab 
> 5.5.2 on Ubuntu 16.04 and
> it seems to works (at least plot3d works).
> 
> I suggest you to reboot and trying to report your issue to Ubuntu on glxgear 
> (which is the right 3D
> testing tool).
> 
> --
> Clément
> 
> Le vendredi 04 novembre 2016 à 12:17 -0700, Tim Wescott a écrit :
> > I'm 99.44% sure that the problem here resides in whatever video stuff
> > just got updated on Ubuntu 14.04 -- but the problem only seems to
> > exhibit itself under Scilab.
> > 
> > So, I'm hoping that someone of a more developer-ish bent could give me a
> > more mainstream Ubuntu test that'll let me submit a bug report to those
> > guys that'll attract attention.  Even better yet, if someone has some
> > suggested workarounds that would be exceptionally lovely.  I'm trying to
> > get some work delivered to a customer TODAY and things have just come to
> > a screeching halt -- hopefully I have a laptop around here that'll work.
> > 
> > I can't tell you details about the graphics card & whatnot, but I'm
> > willing to dig for it if you tell me it's important.
> > 
> > Attached are two files: devices.txt is the output of the "ubuntu-drivers
> > devices" command, while "scilab.doesnt.graph.txt" is the output of
> > Scilab's error stream when I start up, try to graph something, then
> > exit.  The program gets as far as opening a window on which to graph,
> > but fails utterly to actually put up a graph.
> > 
> > I tried installing and running glxgears, but it just says it can't get
> > an RGB channel without saying why -- I don't know if this is part of the
> > problem or not.
> > 
> > ___
> > users mailing list
> > users@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


[Scilab-users] Question about lin -- why rand()?

2016-10-12 Thread Tim Wescott
In responding to the post by "gabrielgga" about system linearization, I
looked at the 'lin' script to understand it.  It does the linearization
by generating a set of random perturbation vectors, perturbing the
system, and then numerically solving for the Jacobians.  As such, it
coughs up a slightly different linearization each time.  The
linearization is largely accurate, but the difference from ideal is more
than I'd (perhaps naively) expect.

Why?  If this is a well-known technique, please feel free to point me at
a paper.

-- 

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


Re: [Scilab-users] Plot format changes

2016-10-06 Thread Tim Wescott


(Sent previously just to Samuel by mistake)
drawlater();
gfig = gcf ();



drawnow();


Sent from my Verizon 4G LTE smartphone

 Original message 
From: Samuel Gougeon <sgoug...@free.fr> 
Date: 10/6/16  2:13 PM  (GMT-08:00) 
To: t...@wescottdesign.com, Users mailing list for Scilab 
<users@lists.scilab.org> 
Subject: Re: [Scilab-users] Plot format changes 

Le 06/10/2016 21:57, Tim Wescott a écrit :
> So, I have some code that works all right, it works all right but not
> exactly quite*:
>
>  errbar(time(ixg) / sampleRate, ..
>  demodulator.eqData.idealPulse(ix), pv, pv);
>
>  gfig.children(1).children(1).clip_state = 'on';
>  gfig.children(1).children(1).segs_color = 4;
>
> This has worked for me splendedly for years, but there's something about
> the data that I'm running through it today that makes it error out,
> reporting that
>
> !--error 999
> 'clip_state' property does not exist for this handle.
.
Where and how is gfig defined?



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


[Scilab-users] Plot format changes

2016-10-06 Thread Tim Wescott
So, I have some code that works all right, it works all right but not
exactly quite*:

errbar(time(ixg) / sampleRate, ..
demodulator.eqData.idealPulse(ix), pv, pv);

gfig.children(1).children(1).clip_state = 'on';
gfig.children(1).children(1).segs_color = 4;

This has worked for me splendedly for years, but there's something about
the data that I'm running through it today that makes it error out,
reporting that

!--error 999 
'clip_state' property does not exist for this handle.

Is there something about the errbar function that would cause this thing
to not HAVE a clip_state?  When I look at 'gfig', gfig.children(1) does
have a clip_state -- but that's not where that data object should be.

(just FYI it's printing out a horribly complicated plot to debug an
algorithm -- it's a plot with 55 sub-plots, each one keeping track of
one version of the algorithm, all of which are running in parallel.)

* Name that tune.

-- 

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


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

2016-10-06 Thread Tim Wescott
For that matter, you can pass a vector of infemums and supremums for
each element of the vector you're optimizing.  (and +inf and -inf work,
for things that don't matter).  As long as you can optimize within a
rectilinear space then you can easily dodge the "bad" values.  It's in
the help for optim.

On Thu, 2016-10-06 at 13:12 +0200, Serge Steer wrote:
> 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

-- 

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


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

2016-10-05 Thread Tim Wescott
To the extent that this may have been sparked by my comments in your
thread about the FFT ("shift phase in fft"):

Please don't stop asking questions here if it is the forum that you are
the most comfortable with.  

I was expressing the opinion that for discussions of the underlying
math, there are other resources, and I was acting on a -- possibly
unfounded, in your case -- concern arising from seeing other people who
seem to have difficulty unraveling the behavior of the tool from the
structure of the underlying math.

As long as I'm subscribed to the list, I won't hesitate to discuss the
underlying math when I think that's warranted.  And, in those cases
where I actually know how to make the tool cough up results in ways that
aren't totally screwy, I'll speak up there, too.

On Tue, 2016-10-04 at 19:31 +0200, paul.carr...@free.fr wrote:
> Hi
> 
> Recently somebody reminded me that the current mailing list is
> dedicated to Scilab topics (on only to) i.e. on ways on using Scilab.
> 
> Does it exist a forum dedicated to developments using Scilab, so that
> people can share skills or ask for support(s) in specific
> topics/tasks? In my mind a way to share codes and so on!
> 
> Nb: Equalis forum is nearly dead, developper.com is for French
> speakers ... 
> 
> I've been hesitating in writting this post, but I'm thinking it might
> be an interesting questionning ... if not it does not matter
> 
> Paul
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 

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


Re: [Scilab-users] shift phase in fft

2016-09-29 Thread Tim Wescott
Hey Paul:

Just a comment, and I hope that neither you nor the rest of the crew on
this list take it as being negative:

The last few questions you've been asking have been in the context of
Scilab, but for the most part they seem to be questions about signal
processing, not about Scilab itself.  One of the distressing trends I
see in DSP forums is the tendency for people -- mostly people who are
self-taught -- to have trouble separating DSP knowledge from which
buttons to push in Scilab (or Matlab, if they happen to have it
available).

Scilab is a great numerical tool, and if I didn't have it I couldn't do
my work nearly as efficiently as I do.  But much of DSP is purely math,
and not numerical at all -- you can use Scilab to shine a light on it,
but Scilab isn't the thing itself.

There's plenty of people on this list who know signal processing and who
will be happy to help you, so if you don't want to step outside of it I
hope you continue posting questions here.  However, for your purely DSP
questions, you may want to consider posting on the USENET group
comp.dsp, or on www.dsprelated.com.  You'll get a wide range of DSP
minds concentrated on your questions, and they'll mostly be people who
will be willing to help you understand the principles independently from
any tools (like Scilab).

Again -- I wish to apologize in advance if I'm stepping on any toes, or
making anyone feel unwelcome.  It is certainly not my intent.

On Thu, 2016-09-29 at 12:29 +0200, paul.carr...@free.fr wrote:
> Dear all
> 
> 
> I'm sorry about asking a so basic question, but I do not understand
> how to make a shift phase in a fft ; There's something I do not catch
> what ?
> 
> 
> Regards
> 
> 
> Paul
> 
> 
> 
> 
> ##
> mode(0)
> clear all
> 
> 
> f = 10; // frequency
> omega = 2*%pi*f; // circular frequency
> nb_T = 5; // number of periods
> t1 = 0;
> t2 = (nb_T / f);
> n = 10;
> t = linspace(t1,t2,2^n)'; // must be a power of 2
> nl = size(t,"*");
> 
> 
> s1 = 2*sin(omega*t); // original signal
> plot(t,s1,"r");
> 
> 
> phi = %pi/3;
> s2 = 2*sin(omega*t + phi); // targetted signal to be rebuilt
> plot(t,s2,"b");
> 
> 
> // shift phase in the fft
> s1_fft = fft(s1);
> s1_fft = clean(s1_fft);
> //s1_fft = s1_fft. * exp(-%i*phi/nl);
> s1_fft = s1_fft. * exp(-%i*phi);
> s1_new = ifft(s1_fft);
> plot(t,s1_new,"g");
> 
> 
> 
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 

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


Re: [Scilab-users] System Identification for First order delay and dead time

2016-09-29 Thread Tim Wescott
The FFT will work.  It is only exact for periodic signals, but it's a
reasonable approximation for a whole lot of signals of infinite extent.
If you can arrange for a test input that's got the same value at
beginning and end (like a step-up followed by a step-down), and then
measure long enough so that your system under test has settled close to
its final value, then you can just use the FFT as is.  If you can't do
that (for instance, if your input is random, or if you can only do a
step up), then take a good long measurement around the event and window.

On Thu, 2016-09-29 at 07:09 -0700, Fukashiimo wrote:
> Dear Tim, 
> 
> 
> Thank you for your reply. 
> 
> 
> First, you're not doing what I recommended you do. Why? <== As I
> informed you that my inut u is not periodic. I thought that it is not
> practical to use fft to my problem. Is my understanding not right? Is
> fft the recomeded method for my problem? 
> In addition to that I am not familiar with fft. 
> 
> 
> Best Regards, 
> 
> 
> - 元のメッセージ - 
> 差出人: "Tim Wescott [via Scilab / Xcos - Mailing Lists Archives]"
> <[hidden email]> 
> 宛先: "Fukashiimo" <[hidden email]> 
> 送信済み: 2016年9月28日(水曜日) 01:32:24 
> 件名: Re: System Identification for First order delay and dead time 
> 
> First, you're not doing what I recommended you do.  Yet you are 
> addressing me for help with your solution, when I've already
> suggested 
> two.  Why? 
> 
> Second, your prototype transfer function is 11th order, and you
> instruct 
> time_id to find the best fit to a second-order transfer function.
>  You 
> are surprised that get a transfer function in return that's not a
> good 
> fit.  Why? 
> 
> Third, you've been told that Scilab does not have a pre-packaged way
> of 
> doing a fit to a system with pure time delay, and you've been given
> more 
> than one suggestion for how to roll your own.  You don't seem to have 
> taken any of these suggestions.  Why? 
> 
> On Tue, 2016-09-27 at 07:30 -0700, Fukashiimo wrote: 
> 
> > Dear Tim, 
> > 
> > Thank you for yor advise. 
> > 
> > However, u is the step signal, such as 50% ==>60% ==> 50%. 
> > u and y are sampled with constant interval, such as one second. 
> > 
> > 
> > 
> > I made following Scilabe code, using time_id: 
> > 
> > // 
> > z=poly(0,'z'); 
> > h=(0.065/(z-0.934))*(1/z^10)//<== 10 Sampling period dead time 
> > u=zeros(1,100); 
> > for i=10:1:100 
> > u(1,i)=2.0; 
> > end 
> > t=1:1:100; 
> > rep=flts(u,tf2ss(h)); 
> > plot(t,rep,t,u)//  <== We can see the step type process input with 
> > amplitude=2 and its process response with 10 sampling period dead 
> > time. 
> > k=find(rep<>0,1) //here the threshold has to be improved in case of 
> > noisy signal 
> > //H=time_id(1,"step",rep(k:$)) 
> > H=time_id(2,u,rep) 
> > rep=flts(u,tf2ss(H)); 
> > plot(t,rep,'.r')// <== We can see the process response by
> identified 
> > model. 
> > H 
> > 
> > 
> > h  = 
> >   
> >0.065   
> > ---   
> >   10  11   
> >   - 0.934z + z 
> > 
> > 
> > H  = 
> >   
> >   0.0265880 
> > -   
> >   - 0.9779092 + z 
> > 
> > 
> > h is the discreate transfer function to provide operation data. 
> > H is the identified transfer function obtained from the opeartion
> data 
> > using time_id. 
> > 
> > I have two issues. 
> > 1. H is not similar to h even the data doesn't include any noise.
> How 
> > I can obtain transfer function nearly same as h? 
> > 2. I would like to have continuous transfer function. How I should 
> > convert the discreate transfer function to continuous transfer 
> > function. 
> > 
> > 
> > I am lokking for a solution for these two issues. 
> > May I ask your advise again? 
> > 
> > 
> > Thanks. 
> > 
> > 
> > - 元のメッセージ - 
> > 差出人: "Tim Wescott [via Scilab / Xcos - Mailing Lists Archives]" 
> > <[hidden email]> 
> > 宛先: "Fukashiimo" <[hidden email]> 
> > 送信済み: 2016年9月26日(月曜日) 04:07:52 
> > 件名: Re: System Identification for First order delay and dead time 
> > 
> > Heh.  I just realized a better way to do this: 
> > 
> > I assume that you've sampled u and y at a constant rate, and that
> you 
> > have captured some reasonable amount of the response.  This will be 
> > perfect if u is periodic. 
> > 
> &

Re: [Scilab-users] System Identification for First order delay and dead time

2016-09-27 Thread Tim Wescott
First, you're not doing what I recommended you do.  Yet you are
addressing me for help with your solution, when I've already suggested
two.  Why?

Second, your prototype transfer function is 11th order, and you instruct
time_id to find the best fit to a second-order transfer function.  You
are surprised that get a transfer function in return that's not a good
fit.  Why?

Third, you've been told that Scilab does not have a pre-packaged way of
doing a fit to a system with pure time delay, and you've been given more
than one suggestion for how to roll your own.  You don't seem to have
taken any of these suggestions.  Why?

On Tue, 2016-09-27 at 07:30 -0700, Fukashiimo wrote:
> Dear Tim, 
> 
> Thank you for yor advise. 
> 
> However, u is the step signal, such as 50% ==>60% ==> 50%. 
> u and y are sampled with constant interval, such as one second. 
> 
> 
> 
> I made following Scilabe code, using time_id: 
> 
> // 
> z=poly(0,'z'); 
> h=(0.065/(z-0.934))*(1/z^10)//<== 10 Sampling period dead time 
> u=zeros(1,100); 
> for i=10:1:100 
> u(1,i)=2.0; 
> end 
> t=1:1:100; 
> rep=flts(u,tf2ss(h)); 
> plot(t,rep,t,u)//  <== We can see the step type process input with
> amplitude=2 and its process response with 10 sampling period dead
> time. 
> k=find(rep<>0,1) //here the threshold has to be improved in case of
> noisy signal 
> //H=time_id(1,"step",rep(k:$)) 
> H=time_id(2,u,rep) 
> rep=flts(u,tf2ss(H)); 
> plot(t,rep,'.r')// <== We can see the process response by identified
> model. 
> H 
> 
> 
> h  = 
>   
>0.065   
> ---   
>   10  11   
>   - 0.934z + z 
> 
> 
> H  = 
>   
>   0.0265880 
> -   
>   - 0.9779092 + z 
> 
> 
> h is the discreate transfer function to provide operation data. 
> H is the identified transfer function obtained from the opeartion data
> using time_id. 
> 
> I have two issues. 
> 1. H is not similar to h even the data doesn't include any noise. How
> I can obtain transfer function nearly same as h? 
> 2. I would like to have continuous transfer function. How I should
> convert the discreate transfer function to continuous transfer
> function. 
> 
> 
> I am lokking for a solution for these two issues. 
> May I ask your advise again? 
> 
> 
> Thanks. 
> 
> 
> - 元のメッセージ - 
> 差出人: "Tim Wescott [via Scilab / Xcos - Mailing Lists Archives]"
> <[hidden email]> 
> 宛先: "Fukashiimo" <[hidden email]> 
> 送信済み: 2016年9月26日(月曜日) 04:07:52 
> 件名: Re: System Identification for First order delay and dead time 
> 
> Heh.  I just realized a better way to do this: 
> 
> I assume that you've sampled u and y at a constant rate, and that you 
> have captured some reasonable amount of the response.  This will be 
> perfect if u is periodic. 
> 
> If u is periodic, then for some integer number of periods, take U = 
> fft(u) and Y = fft(y).  If u isn't periodic, then take FFT's of u and
> y 
> after windowing them both with identical windows. 
> 
> Now calculate the frequencies for each bin of the above fft's. 
> 
> Define H(w) = ( K ./ (%i * tau * w + 1) ) .* exp(-%i * w * T). 
> 
> Calculate Ymodel = U .* H(w) 
> 
> Now, thanks to the magic of Parseval's Theorem, 
> norm(Y - Ymodel) is the same as, or just a constant multiplier away
> from 
> being, norm(y - ymodel) -- but you never actually have to compute 
> ymodel. 
> 
> So optimize on tau and T as described before.  You should only have
> to 
> take your FFTs once at the beginning -- the rest will be repeatedly 
> calculating H(w) for the various values of tau and T (and K, if you
> want 
> to be lazy and just toss it into optim, although it'll be much faster
> to 
> determine it using least-squares fit). 
> 
> On Sun, 2016-09-25 at 01:07 -0700, Fukashiimo wrote: 
> 
> > Thank you for your suggestion. However, I am not sure how I should 
> > formulate my Laplace domain equation. Could you please advise me
> more 
> > specifically? 
> > 
> > Thanks. 
> > 
> > 
> > 2016/09/25 午前9:33 "Tim Wescott [via Scilab / Xcos - Mailing Lists 
> > Archives]" <[hidden email]>: 
> > I suggest that you roll your own cost function, and use 
> > optim. 
> > 
> > Where possible, with optim, if part of the problem is 
> > nonlinear and part 
> > is linear, it's good to use a plain old linear
> least-squares 
> > fit for the 
> > plain old linear part.  In your case, that's K.  Tau and Td 
> > will have to 
> >  

Re: [Scilab-users] fourier series and fft

2016-09-22 Thread Tim Wescott
Hey Paul:

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

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

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

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

-- 

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


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


Re: [Scilab-users] How to print int64 or uint64 integers at full accuracy?

2016-08-28 Thread Tim Wescott
A kludge would be to make it into two integers.  This works for positive
integers, but verifying (or modifying) the algorithm to signed numbers
is left as an exercise to the reader:

A = (some 64-bit constant)
A_1 = A / 10;
A_0 = A - A_1 * 10;

if (A_1 == 0)
  mprintf("A = %d\n", A);
else
  mprintf("A = %d%09d\n", A_1, A_0);
end // if

Woo hoo!  Eight lines and an if statement where you wanted something
embedded in mprintf.  What could be better?

On Mon, 2016-08-29 at 00:05 +0200, Samuel Gougeon wrote:
> Hello all,
> 
> I am wondering how it is possible to print (in a file, in a string)
> new 64 bit integers,
> at full accuracy. Their relative accuracy is better than for decimal
> numbers
> (1/2^63 instead of %eps=1/2^52).
> 
> In Scilab 5, digits lower than 1/%eps -- that are somewhat randomly
> set --
> can be displayed but are not relevant:
> -->format(24)
> -->%pi
>  %pi  =
> 3.141592653589793115998
> 
> -->(%pi-3.141592653589793)==0
>  ans  =
>   T  
> 
> In Scilab 6, digits beyond %eps are displayed as 0. This is great:
> --> format(24)
> --> %pi
>  %pi  = 
>3.14159265358979310
> 
> However, this change is applied to all numbers, even to integers.
> The issue is that Scilab 6 also brings super-integers :) int64 /
> uint64
> having 64-bit mantissae, instead of 53-bit mantissae for decimal
> numbers.
> Hence, int64 have a relative accuracy better than %eps.
> Unfortunately the related digits can't be printed.
> Only the default display in console works.
> Examples:
> i = int64(2)^62 + 1
> printf("%d  %i  %ld  %li \n", i, i ,i, i)
> format(22)
> string(i)
> // I found this undocumented trick with printf format, but there is
> the same truncature:
> printf("%20.0f\n", i)
> 
> // Results:
> --> i = int64(2)^62 + 1
>  i  = 
>   4611686018427387905// The right value!
> 
> --> printf("%d  %i  %ld  %li \n", i, i ,i, i)
> -2147483648  -2147483648  -2147483648  -2147483648// Oups. %lld
> does nor work
> 
> --> format(22)
> --> string(i)
>  ans  =
>  4611686018427387900// bad trailing zeros
> 
> --> // I found this undocumented trick with printf format, but there
> is the same truncature:
> --> printf("%20.0f\n", i)
>  4611686018427387900// Same issue (final 5 missing)
> 
> 
> I started looking for a solution with write() and its fortran
> formating,
> but it looks no more ready for int64 integers.
> 
> Would you know any solution?
> 
> Thanks
> Samuel
> 
> ___
> 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


[Scilab-users] Constrained optimization speed vs. unconstrained

2016-08-27 Thread Tim Wescott
"optim" allows you to submit a constraints vector for the optimization.

How much does using constrained optimization affect the optimization
speed?  I.e., take the wholly hypothetical case where I'm optimizing
some function f(x) with binf and bsup specified, and that the
optimization never ever hits binf or bsup.

Is the constrained optimization slower than the unconstrained
optimization?  Is there any general way, short of doing the experiment,
to know how much slower?

Thanks in advance...

-- 

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


[Scilab-users] Memory leak (v. 5.5.0)

2016-07-08 Thread Tim Wescott
I don't know why, but the attached script makes Scilab gobble up memory
like a bandit.  Granted, I'm running it over and over, but still...

I don't know if this happens with more recent versions.

Run the following, while keeping an eye on memory usage.  Memory is just
sucked up, and not returned until Scilab is terminated.

for n = 1:500; b = makeVector(b, 1e4); end

-->ver
 ans  =
 
!Scilab Version:
5.5.0.1397209685!
!   
 !
!Operating System:   Linux
3.16.0-76-generic !
!   
 !
!Java version:
1.7.0_101   !
!   
 !
!Java runtime information:   OpenJDK Runtime Environment (build
1.7.0_101-b00)   !
!   
 !
!Java Virtual Machine information:   OpenJDK 64-Bit Server VM (build
24.95-b01, mixed mode)  !
!   
 !
!Vendor specification:   Oracle
Corporation  !
 

-- 

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


makeVector.sci
Description: application/scilab-sci
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] a beginner question

2016-06-18 Thread Tim Wescott
In Linux, at least, I just go to the desired directory at the command
line and type

scilab &

(the '&' is to make Scilab run in the background).

I suspect that you can do this in Windows, but without being able to run
in the background.

Alternately, you can always just start up Scilab and then use 'cd' to go
where you want.

On Sat, 2016-06-18 at 13:05 +0300, Offe rPade wrote:
> How to make scilab open in a certain directory
> 
>  
> 
> 
> ___
> 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


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

2016-04-04 Thread Tim Wescott
In the graph that you posted some time back (sorry, I haven't been
saving emails), it appears that the x-axis numbers are not increasing
monotonically.  This is what led me (and, apparently, others) to assume
that the y-axis is the controlled variable.

If the machine is, indeed, stepping backwards when it's unhappy,
couldn't you just snip out the earlier instance of the same x-axis
value, and reorder as necessary?  Would this make for happy data?

I agree that asking the machine manufacturer what's what is best at this
point.  It does seem odd that they're not snipping out the data they
determine is bad -- if you're really lucky they're doing an outstanding
job, and you just need to figure out how to ask the machine to suppress
the bad data before you get it.

On Mon, 2016-04-04 at 10:38 -0800, scilab.20.browse...@xoxy.net wrote:
> Serge,
> 
> > 
> > If your data are regulary sampled along the y axis you can use the
> 
> The X-axis is the controlled variable, the Y-axis the dependent.
> 
> However, (from my understanding which is sketchy), the software controlling 
> the input has a feedback loop and attempts to adjust the rate and spacing of 
> the input to provide good data around the fine detail of the slope; so the 
> input isn't necessarily exactly linear, though if you inspect the output 
> closely, it seems to have a linear step size.
> 
> Indeed. I suspect that the discontinuities I'm seeing are a result of the 
> control software back-stepping around certain positions to correct for 
> detected 'external influences' (such as eddy current build-up or induction 
> lag). It is this hypothesis that I am going to try to get conformed by the 
> equipment manufacturer.
> 
> > 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)
> 
> > 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?)
> 
> Or should I be looking somewhere else?
> 
> > 
> > Serge Steer
> 
> Cheers, Buk.
> 
> 
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/password-manager
> 
> 
> 
> ___
> 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


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

2016-04-04 Thread Tim Wescott
nition. 
> 
> The problem with that is that it throws away much of the subtlety of the 
> data; which for silicon steel laminates doesn't matter; but for 
> amorphous/nono-crystalline  metals, can mask important parts of their 
> desirable behaviours.
> 
> Indeed, my entire foray into learning SciLab is to try and establish a good 
> method for pre-processing these kind of curves so that it strikes the balance 
> between horrendous run times; and using artificial substitutes that ignore 
> those subtleties.
> 
> And yes. You've certainly given me food for thought :)
> 
> 
> 
> > 
> > I'm taking "smoothing" to mean "filtering" here.
> > 
> > In general the filtering problem is to decide on the characteristics of
> > your desired signal, the characteristics of your noise, and then make
> > some mathematical transformation that minimizes the effects of anything
> > with noise-like characteristics while retaining as much of anything with
> > desired-signal-like characteristics.
> > 
> > This has two salient corollaries: first, you have to know what the
> > characteristics of your signal and noise are; and second, the more that
> > your signal resembles your noise, the less of it you will be able to
> > recover.
> > 
> > You can spin off from there in a number of different directions, leading
> > you to a number of different filtering techniques.
> > 
> > It appears that you're doing your measurements by varying some
> > controlled parameter along the vertical axis and measuring along the
> > horizontal axis.  If this is the case, then I would start by trying
> > filtering techniques using the vertical axis as your "time" axis.
> > 
> > There is no linear filtering technique (i.e., output sample = weighted
> > some of a vector of input samples) that you can use that guarantees
> > monotonicity for all possible inputs.  If you use linear filtering then
> > you need to verify monotonicity by experiment.  If your FEC program is
> > messed up by noise as much as non-monotonicity, then this is not a bad
> > thing -- it's just an indication that you're filtering heavily enough.
> > 
> > If the problem really, truly is monotonicity, then take the derivative
> > at each point, and snip out the points that go the wrong direction.  I
> > suspect this won't lead to joy, but it'll meet your stated objectives.
> > 
> > If the problem with the smoothing filters that you've tried is that it
> > works well in some spots and not in others, then consider using a filter
> > whose properties vary depending on where on the axis your output sample
> > is located.  This isn't something that you'll find pre-packaged --
> > you'll have to whomp something up using more primitive functions of
> > Scilab.
> > 
> > I could go on and on -- sorry for coming to a disorganized end here, but
> > I hope I'm giving you some food for thought.
> >
> 
> 
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
> family!
> Visit http://www.inbox.com/photosharing to find out more!
> 
> 
> 
> ___
> 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


Re: [Scilab-users] Running an .sce from the command line. message 9 (scilab: message 11 of 20) of 20)

2016-04-01 Thread Tim Wescott
nce the plot() executes and the graphic window appears, control and
> >>> focus returns to the interactive command line.
> >> Scilab's console, i guess not the shell terminal.
> >> 
> >>> That's okay; but it'd would be really nice if the focus remained on the
> >>> graphic window until it was closed and then the scilab shell exited
> >>> automatically.
> >> Graphics are not modal: AFAIK it is not possible to lock the console
> >> with a figure until the figure is closed (or until any other event)(you
> >> could use a for loop waiting for an event ; but it won't reject CTRL-C
> >> interruptions).
> >> However, to close automatically Scilab when the figure is closed, you
> >> may add the following in your script:
> >> gcf().closerequestfcn="exit(0)";
> >> 
> >> HTH
> >> Samuel
> >> 
> >> ___
> >> users mailing list
> >> users@lists.scilab.org
> >> http://lists.scilab.org/mailman/listinfo/users
> > 
> > 
> > Can't remember your password? Do you need a strong and secure password?
> > Use Password manager! It stores your passwords & protects your account.
> > Check it out at http://mysecurelogon.com/manager
> > 
> > 
> > 
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
> 
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/password-manager
> 
> 
> 
> ___
> 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


Re: [Scilab-users] Running an .sce from the command line. message 9 of 20)

2016-03-31 Thread Tim Wescott


plot2d (a, b, logflag = "ln")
Look at help for plot2d for details. 


Sent from my Verizon Wireless 4G LTE smartphone

 Original message 
From: scilab.20.browse...@xoxy.net 
Date: 03/31/2016  4:38 PM  (GMT-07:00) 
To: users@lists.scilab.org 
Subject: Re: [Scilab-users] Running an .sce from the command line. message 9
  of 20) 

Samuel,

Thanks. I had to do it in two steps:

    f = gcf();
    f.closerequestfcn="exit(0)";

otherwise I get:

    gcf().closerequestfcn="exit(0)";
 !--error 2
    Invalid factor.

The focus still returns to the command line console pushing the graphics window 
into the background and meaning I have to go looking for it to see the plot; 
but when I close it the console exits back to the OS.

Next problem, that should probably be a new thread: How to avoid the 
Singularity of log function from preventing the script completing if the data 
contains zeros?

I'm doing:

    plot( log10( a ), b );

To produce the log plot. 



> -Original Message-
> From: scilab.browseruk.bb30c473ec.sgougeon#free...@ob.0sg.net
> Sent: Thu, 31 Mar 2016 21:09:20 +0200
> To: users@lists.scilab.org
> Subject: Re: [Scilab-users] Running an .sce from the command line.
> (scilab: message 9 of 20)
> 
> Hello,
> 
> Le 31/03/2016 20:35, scilab.20.browse...@xoxy.net a écrit :
>> Hi,
>> 
>> I can run my .sce file which produces a graph from a file of data from
>> the (windows) command line using:
>> 
>>  scilex -f myscript.sce filename.rdat
>> 
>> and that works except:
>> 
>> Once the plot() executes and the graphic window appears, control and
>> focus returns to the interactive command line.
> Scilab's console, i guess not the shell terminal.
> 
>> That's okay; but it'd would be really nice if the focus remained on the
>> graphic window until it was closed and then the scilab shell exited
>> automatically.
> Graphics are not modal: AFAIK it is not possible to lock the console
> with a figure until the figure is closed (or until any other event)(you
> could use a for loop waiting for an event ; but it won't reject CTRL-C
> interruptions).
> However, to close automatically Scilab when the figure is closed, you
> may add the following in your script:
> gcf().closerequestfcn="exit(0)";
> 
> HTH
> Samuel
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/manager



___
users mailing list
users@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] Running an .sce from the command line.

2016-03-31 Thread Tim Wescott
xend().

I don't know if this is what you want, but the enclosed .sce file
generates a graph, writes an image to a .eps file, and then exits.  This
is how I generate graphs for papers -- it gives me a more maintainable
way to replicate the graphs later, or tweak them, or whatever.

Note that there are some dependencies that I'm not sharing, so it won't
work.  You should still get an idea of how it works, or maybe chop out
the dependencies and try it out.

It should be one of the figures in this paper:
http://wescottdesign.com/articles/Friction/friction.pdf.

On Thu, 2016-03-31 at 10:35 -0800, scilab.20.browse...@xoxy.net wrote:
> Hi,
> 
> I can run my .sce file which produces a graph from a file of data from the 
> (windows) command line using:
> 
> scilex -f myscript.sce filename.rdat
> 
> and that works except:
> 
> Once the plot() executes and the graphic window appears, control and focus 
> returns to the interactive command line.
> 
> That's okay; but it'd would be really nice if the focus remained on the 
> graphic window until it was closed and then the scilab shell exited 
> automatically. 
> 
> Is it possible to arrange for that to happen?
> 
> Thanks, Buk.
> 
> 
> TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if5
> Capture screenshots, upload images, edit and send them to your friends
> through IMs, post on Twitter®, Facebook®, MySpace™, LinkedIn® – FAST!
> 
> 
> 
> ___
> 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


motor-PD-friction.sce
Description: application/scilab-sce
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Invalid index?

2016-03-30 Thread Tim Wescott
At the risk of sounding like a theologian, what is god?

On Wed, 2016-03-30 at 05:48 -0800, scilab.20.browse...@xoxy.net wrote:
> This one has me baffled!
> 
> If I run this code:
> ...
> god.vars = []; 
> for i=1:11
> disp(i);
> god.vars(i)  = 1; // uicontrol( god.frame1, 'style', 'text', 'string', 
> god.labels(i), 'position', [ i*60 - 8 + fudge, 30, 10, 20 ] );
> ...
> end
> 
> It completes without error.
> 
> But if I uncomment the uicontrol:
> 
> god.vars(i)  = uicontrol( god.frame1, 'style', 'text', 'string', 
> god.labels(i), 'position', [ i*60 - 8 + fudge, 30, 10, 20 ] );
> 
> The assignment to god.vars(i) works when i == 1;, but fails when i == 2 as 
> follows:
> 
> -->exec('C:\test\poly.sce', -1)
>  
> 1.  
>  
> 2.  
> god.vars(i)  = uicontrol( god.frame1, 'style', 'text', 'string', 
> god.labels(i), 'position', [ i*60 - 8 + fudge, 30, 10, 20 ] );
>   
>  !--error 21 
> Invalid index.
> at line  43 of exec file called by :
> exec('C:\test\poly.sce', -1)
>  
> I've eliminated the only other index usage (god.labels(i)) as a problem;
> 
> so why can it assign to god,vars(1) and not to god.vars(2)?
> 
> 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
> 
> 

-- 

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


Re: [Scilab-users] A generic datastructure dump tool?

2016-03-29 Thread Tim Wescott
On Tue, 2016-03-29 at 11:32 -0800, scilab.20.browse...@xoxy.net wrote:
> >After getting the handle PL of your polyline, you can directly update its 
> >points through PL.data 
> >Then, the graphics is directly updated. You don't need to redraw it with 
> >plot() ot plot2d(). 
> 
> >HTH 
> >Samuel
> 
> Thanks Samuel, that works brilliantly. The re-draw is so fast I had to insert 
> a sleep( 10 ) between iterations.
> 
> A follow up question (assuming that isn't breaking the list rules).
> 
> Is there a better way than using a for loop to map two vectors x, y to a 
> matrix ( [x1,y1],[x2,y2], ... )?
> 
> Cheers, Buk.

Given two column vectors x and y, m = [x y] should work nicely.  If you
need to put two row vectors one atop the other use m = [x; y].  If you
need to put two row vectors into two columns, m = [x' y'].

(but note that x' means to make a conjugate transpose -- you don't care
now, but if you want to move complex numbers around without conjugation,
use x.')

-- 

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


Re: [Scilab-users] Optimization: First order delay and dead time TF model ID, CUTEr

2016-03-25 Thread Tim Wescott
On Fri, 2016-03-25 at 09:54 -0700, noguchi wrote:
> Hello, SCilab Users,
> 
> May I ask your help?
> 
> I still not find practical solution to minimize my object function by Scilab
> tools.
> Model: ym(n)=ym(n-1)*amp+Kpm*bmp*u(n-1-Tdm)  where n=step=1:1:500) 
> Object function: sum of square of (y(n)-ym(n))
> 
> 
> Using Excel, I made same objective funtion and minimize it by solver. The
> solution is sometimes good but some times bad. Therefore, I still need
> Scilab code to solve this problem.
> 
> May I ask how I can wrote scilab commend to solve this problem?
> 
> Thank you for your help.
> 
> 
> Y. Noguchi FODDT_ModelID_SISO_r0.xls
> <http://mailinglists.scilab.org/file/n4033859/FODDT_ModelID_SISO_r0.xls>  
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033859.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
> 
> 

I don't have time to work up an example of this, but -- have you looked
at the help page for datafit?  It looks like it'll do the job (I know
how to do this with optim, but I suspect that I should have been using
datafit for a lot of that stuff).

You may want to make sure you know what you're optimizing _for_ -- I
assume that ym(0) = 0, and that amp, Kpm, bmp and Tdm are your free
parameters.

If so, you may want to revisit your problem -- Kpm and bmp are
redundant; if you're trying to optimize on both of them then you may be
confusing the optimizer.

-- 

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


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

2016-03-12 Thread Tim Wescott
If you're going to be doing this often it may be profitable to get a
book on system identification.  I can't be sure because I haven't had to
do it, but I'm pretty sure that system identification with time delay is
an indirect enough process that there will be multiple ways to do it,
each one being good in some particular set of circumstances.

On Sat, 2016-03-12 at 06:39 -0700, noguchi wrote:
> Dear Mr.Serge, 
> 
> 
> Thank you for your advise.
> 
> I didn't know that step should start from the beginning.
> 
> If there is a scilab tool to identify transport delay and continuous time
> transfer functions (Fist order delay, scond order delay, integral), it would
> be nice.
> 
> 
> Thanks.
> 
> 
> Y. Noguchi
> 
> 
> 
> --
> View this message in context: 
> http://mailinglists.scilab.org/Model-ID-of-First-order-delay-and-Dead-Time-Process-tp4033659p4033709.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
> 
> 

-- 

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


Re: [Scilab-users] Confusion between Scilab and Scicoslab

2016-03-03 Thread Tim Wescott
Answers embedded with questions.

On Thu, 2016-03-03 at 15:48 +0100, Pradeep Pradeep wrote:
> Dear Sir/Madam,
> 
> 
> My name Pradeep Adusumilli. I am a master student at University of
> stuttgart. I am looking for a open source control system design tool
> for my project. so i have come across this tool called Scilab/Xcos and
> Scicoslab. Initially i am very confused between these tools. After i
> downloaded i came to know both environments are different but both
> have same common features. So i want to clear my confusions with my
> questions
> 
> 
> 1) Is Scilab and Scicoslab are the same?
> 
No.  They are different applications, both based on Scilab 4.  

This part is subject to correction, but Scilab moved from using Tcl to
using Java for it's graphics and GUI.  The folks now doing Scicoslab
felt that it would be better to stick with Tcl, and did.
> 
> 2) i have seen both can implement control designs. As far i checked
> with Xcos and Scicos i can see both  can implement conventional PID
> controller and state space controllers like LQR, kalman filter etc.Can
> it implement other controller like Model predictive controller and
> Fuzzy controller? If so can you please provide me some references?
> 
Scilab is a general purpose computing platform and can do anything you
want.



I gather from your question that what you really mean is "are there
toolboxes to do MPC and fuzzy controllers?"

I don't know the answer to that.  The reason is that I don't care.  If I
need a toolbox to do MPC or fuzzy control or whatever, then I don't know
what the hell I'm doing, and I won't be able to move that controller to
the real world without learning it.  Using a toolbox gets in the way of
learning that stuff, so why would I want one?

The alternative way of thinking about this is "oh, I'll just use a
toolbox full of stuff I don't understand and then I'll convert
everything into C code with a converter".  That's an excellent way to
crash planes, disable factories, etc.

I do use bits and bobs of the "toolboxes" that come with Scilab --
generally after I've assured myself that I understand how to do that job
myself, and either looking at the code myself or doing extensive testing
to make sure that I understand what the code is doing.


> 
> 3) I know both can make an interface to C and Fortran coding. My
> question is it possible to interface with MATLAB/Simulink.
> 
Probably not without great difficulty.  I don't think there would be a
great impetus to do so at anything finer-grained than processing a data
file generated by one with a pre-existing application in the other.

Scilab is a different species of animal than Matlab, but they're in the
same genus (in fact, they share a common ancestor).  However, code for
Scilab won't work in Matlab, and visa-versa.

In theory you could probably pipe data from one program to another, but
I can't imagine why you'd want to.
> 
> 4) Is it possible to estimate calculation duration in this environment
> like in matlab it shows simulation took 0.983 sec of cpu time? because
> i would like to know the performance.
> 
Yes.  "tic()" sets a stopwatch timer to zero, "toc()" reads the current
value.  So you write:

tic()



t = toc();

mprintf("execution time = %f\n", t);

and you find out how long things took.
> 
> 
> 
> Your help means a lot to me. Thanks for your support in advance.
> Awaiting your reply.
> 
> 
> Regards,
> Pradeep Adusumilli
> 
> 
> 
> 
> ___
> 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


Re: [Scilab-users] Logical zero

2016-02-01 Thread Tim Wescott


I believe that a = zeros(n, m) == 1 will do it, but it may not be either the 
best or the official way. 


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


Re: [Scilab-users] Loop query - Scilab 5.5.2

2016-01-18 Thread Tim Wescott
Or you can build a three column array as a matrix.  Here's my example,
but I don't see where 'x' is defined.

Te = (5000:1:25000)';
D = E * Te .^ 3 / (12 * (1 - v^2));
lambda = ((rho_m - rho_fill) * g ./ (4 * D)) .^ 0.25;
lambda_k = lambda * 1000;
flex = (2 * Pb * lamda / ((rho_m-rho_fill)*g)) .* ..
   exp(-lamda_k .* x) .* cos(lamda_k .* x);

On Mon, 2016-01-18 at 14:48 +0100, Serge Steer wrote:
> 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,  <sgoug...@free.fr> 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
> 
> 

-- 

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


Re: [Scilab-users] Scilab conversion of Matlab code - query

2016-01-06 Thread Tim Wescott
On Wed, 2016-01-06 at 10:54 +, Lester Anderson wrote:
> Hello,
> 
> A basic query, but I cannot seem to get the Scilab code to run as it
> should and plot the data. Not sure where it is falling over. Attached
> the code with the original Matlab commands at the front for reference.
> 
> Oddly, the straight Matlab code will run and make the plot after first
> startingSc ilab, but will not if attempted again.
> 
> Is there a more elegant way of reading in a range of Te values?
> 
> Thanks for any pointers

Run it and look at the error messages, then fix them one by one.  It's
barfing a lot on matrix multiplies where you're doing invalid
operations.  Scilab is strict that if you multiply two matrices they
have to be m x n and n x q (or whatever).  I'm not sure what Matlab's
rules are for the equivalent.

Yes, Scilab would let you read Te in from a file -- at it's simplest you
can use fscanfMat, if your file is the right format.

-- 

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


Re: [Scilab-users] Is this a known bug?

2015-12-21 Thread Tim Wescott
Thanks Samuel and Jan.  I've submitted a bug, #14310,
http://bugzilla.scilab.org/show_bug.cgi?id=14310.  We'll see what
happens, I guess.

On Mon, 2015-12-21 at 16:10 +0100, Samuel Gougeon wrote:
> Hi Tim,
> 
> Same memory drift with Scilab 5.5.2 and 6.0-a2 on win7_x64 is
> observed.
> plot2d() is clearly involved, since further tests show that
> r = rand(1, 5000, "n"); 
> for n = 1:1; 
> clf; 
> plot2d(r(1,:) , r(1,:)); 
> end
> already leaks, and apparently faster than when encapsulated in
> graphalot(), while
> r = rand(1, 5000, "n"); 
> for n = 1:1; 
> clf; 
> end
> 
> does not.
> Hope this will help debugging.
> Memory linkage of plot2d() is not yet reported on bugzilla.
> 
> Regards
> Samuel Gougeon
> 
> Le 21/12/2015 06:37, Tim Wescott a écrit :
> 
> > I'm running scilab-5.5.0 on Ubuntu 14.04.
> > 
> > When I run the attached script and then run "graphalot" for a while,
> > Scilab's memory usage climbs monotonically.  What is actually getting
> > plotted doesn't seem to make a difference -- I just did the particular
> > plots seen there because it's fun.
> > 
> > I'm seeing this in a rather large, rather graphics-intensive script I'm
> > using.  If I let the thing go unattended too long then Scilab slows to a
> > crawl and takes my computer with it -- I suspect that if I were willing
> > to wait for geologically significant amounts of time I could stop
> > Scilab, but I usually end up just cringing and whining, then resetting
> > the computer.
> > 
> > (I'm not sure what would happen in Windows, or if there's a better way,
> > under Linux, to make it not drag the rest of the world down.  I just try
> > not to let the problem happen in the first place).
> > 
> > I searched the bugbase for it, but my ability to find good search terms
> > is usually far better in hindsight than actual use.  So -- is this a
> > known bug, or should I file a bug report?
> > 
> > If it's known, has it been fixed?  In what version?
> > 
> > Here's the script, in case file attachment doesn't work on the list:
> > 
> > function graphalot()
> > for n = 1:1; 
> > bob = rand(1, 5000, "n"); 
> > r = flts(bob, [%z^2 - 1; 0.5 * %z] / (%z^2 - 1.95*%z + 0.999)); 
> > scf(0); 
> > drawlater(); 
> > clf; 
> > plot2d(r'); 
> > ssz = stacksize(); 
> > xtitle(sprintf("iteration #%d, stack used %d", n, ssz(2))); 
> > drawnow(); 
> > scf(1); 
> > clf; 
> > drawlater(); 
> > plot2d(r(1, :), r(2, :), frameflag = 3, rect = [-150, -150, 150,
> > 150]); 
> > drawnow(); 
> > end
> > endfunction
> > 
> 

-- 

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


[Scilab-users] Is this a known bug?

2015-12-20 Thread Tim Wescott
I'm running scilab-5.5.0 on Ubuntu 14.04.

When I run the attached script and then run "graphalot" for a while,
Scilab's memory usage climbs monotonically.  What is actually getting
plotted doesn't seem to make a difference -- I just did the particular
plots seen there because it's fun.

I'm seeing this in a rather large, rather graphics-intensive script I'm
using.  If I let the thing go unattended too long then Scilab slows to a
crawl and takes my computer with it -- I suspect that if I were willing
to wait for geologically significant amounts of time I could stop
Scilab, but I usually end up just cringing and whining, then resetting
the computer.

(I'm not sure what would happen in Windows, or if there's a better way,
under Linux, to make it not drag the rest of the world down.  I just try
not to let the problem happen in the first place).

I searched the bugbase for it, but my ability to find good search terms
is usually far better in hindsight than actual use.  So -- is this a
known bug, or should I file a bug report?

If it's known, has it been fixed?  In what version?

Here's the script, in case file attachment doesn't work on the list:

function graphalot()
for n = 1:1; 
bob = rand(1, 5000, "n"); 
r = flts(bob, [%z^2 - 1; 0.5 * %z] / (%z^2 - 1.95*%z + 0.999)); 
scf(0); 
drawlater(); 
clf; 
plot2d(r'); 
ssz = stacksize(); 
xtitle(sprintf("iteration #%d, stack used %d", n, ssz(2))); 
drawnow(); 
scf(1); 
clf; 
drawlater(); 
plot2d(r(1, :), r(2, :), frameflag = 3, rect = [-150, -150, 150,
150]); 
drawnow(); 
    end
endfunction


-- 

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


graphalot.sci
Description: application/scilab-sci
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] integrals

2015-12-07 Thread Tim Wescott
+1 on what Pablo said -- Maxima and/or WxMaxima was what I was going to
recommend (WxMaxima is not only a nice point-and-click interface for
Maxima, it's also a good training tool -- if you try, you can use
WxMaxima to train you up on the Maxima command line.)

Just as a warning: I've used both Maxima and Maple (the commercial
'replacement' for Maxima), and both of them will leave you unsatisfied
if your expectations are too high.  Both applications can reduce "easy"
problems, but as you get to more difficult problems to solve, or if
you're looking for specific simplifications, they fall down.  You can
push their usefulness further by using them as handy calculators for
parts of your problem, or as a check on your work, but ultimately if the
problem at hand is difficult enough there'll have to be some human
neurons hard at work to find the solution.

On Mon, 2015-12-07 at 14:12 -0300, Pablo Fonovich wrote:
> Hi:
> As tim stated before, scilab does numerical calculation of integrals,
> very usefull for ingeneering problems for example... but does not
> provide any function for symbolic calculation of integrals. If you
> really need symbolic computation of an integral, i would recommend you
> using maxima, or wxmaxima if you are a begginner... There is also a
> toolbox for doing symbolic calculation trhough maxima in scilab called
> "scimax", you could try it if you want to do everything in scilab, but
> i think is a bit outdated.
> 
> May i ask you why you need to do a symbolic calculation?
> 
> 
> __
> Date: Mon, 7 Dec 2015 08:48:15 -0600
> From: btove...@gmail.com
> To: t...@wescottdesign.com; users@lists.scilab.org
> Subject: Re: [Scilab-users] integrals
> 
> symbolic solutions
> 
> ___ 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


Re: [Scilab-users] integrals

2015-12-06 Thread Tim Wescott
On Sun, 2015-12-06 at 20:27 -0600, Peter Q. wrote:
> Hi users scilab.
> I was looking for a command for indefinite integrals, intg works on
> defined integrals, so Is the same command? 
> thanks in advance.

Scilab calculates numerical solutions to integrals.  That's not
something that can really be done with an indefinite integral.

Are you looking for numbers, or symbolic solutions?

-- 

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


Re: [Scilab-users] multiple element by element between large matrix and vector

2015-09-27 Thread Tim Wescott
On Sun, 2015-09-27 at 03:53 -0700, David Chèze wrote:
> Hi all,
> 
> I was wondering what are the possibilities to do a product element by
> element between a matrix A (m rows ,n columns)and a vector (let say column
> vector v (m elements) ): I want each element of each column of A to be
> multiplied by each element of v at the same row. What I'm using for now is a
> product by a diagonal matrix based on v. For large matrix in data
> manipulation (typ. 10 rows), it's necessary to use sparse to allocate
> better the diag matrix otherwise it's out of memory for usual machine.
> So i'm using --> diag(sparse(v)) * A
> 
> Have you best practice to share on this topic ?

You may already be using the best way.  Something to try would be

B = A;

for n = 1:size(B, 1)
  B(n, :) = v(n) * A(n, :);
end

I suspect it'll be slower, but you can always give it a whirl and see.
Use tic() and toc() for timing.

If you want to engage in heroic measures, write a C or FORTRAN function
to do what you want, and then learn how to dynamically link it to
Scilab.  I've done this in the past for quaternion arithmetic in a
Kalman filter, but it was a lot of work and not 100% robust in the face
of Scilab upgrades.

Also, if you don't already know about it, stacksize is a handy Scilab
function if you're working with large data arrays.  "stacksize max" will
either give you the biggest Scilab stack that can be had or crash your
machine, depending on your version (it appears to work in the current
version).  "stacksize(nnn)" will set your stacksize to nnn, without
crashing your machine (to my knowledge).  "stacksize" will report the
current stacksize.

-- 

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


Re: [Scilab-users] multiple element by element between large matrix and vector

2015-09-27 Thread Tim Wescott
On Sun, 2015-09-27 at 13:43 +0200, Samuel Gougeon wrote:
> Hi David,
> 
> Le 27/09/2015 12:53, David Chèze a écrit :
> > Hi all,
> >
> > I was wondering what are the possibilities to do a product element by
> > element between a matrix A (m rows ,n columns)and a vector (let say column
> > vector v (m elements) ): I want each element of each column of A to be
> > multiplied by each element of v at the same row. What I'm using for now is a
> > product by a diagonal matrix based on v. For large matrix in data
> > manipulation (typ. 10 rows), it's necessary to use sparse to allocate
> > better the diag matrix otherwise it's out of memory for usual machine.
> > So i'm using --> diag(sparse(v)) * A
> >
> > Have you best practise to share on this topic ?
> .
> I am not sure to catch what you want to do, noticeably what is the 
> format of the result you expect.
> AFAIU, i would do
> A .* (v*ones(1,size(A,2)))

"Otherwise it's out of memory for usual machine"

Meaning, he tried that, and it didn't work.  So he does what DOES work,
which is

diag(sparse(v)) * A

This makes the matrix on the left sparse, with a populated diagonal and
all the rest zeros (presumably v is fully populated).  And, as David has
discovered experimentally, it does not run him out of stack space.

-- 

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


Re: [Scilab-users] Modeling current in a solenoid

2015-09-21 Thread Tim Wescott
On Mon, 2015-09-21 at 08:00 +, Michael Greenish wrote:
> Hi,
> 
> 
> I need to model the current in a solenoid.  I would use a resistor
> with the standard inductor model but the inductance changes
> considerably with position of the solenoid plunger (as the solenoid is
> closing).  The standard inductor model only accommodates a fixed
> inductance.
> 
> 
> The equation for inductor current is:
> 
> 
>   I(t) = (V/R)[1-eˆ(-Rt/L)]
> 
> 
> Anyone have any suggestions?
> 
Hey Mike:

That's the equation for inductor current when driven by a voltage, yes.
It comes from the differential equation:

i(t) * R + (d/dt i(t)) L = V.  It's a first-order ordinary linear
differential equation.

Life gets complicated when you have that solenoid in there.  I'm almost
certain that the correct way to model the i/v behavior of the solenoid
is

v_l(t) = d/dt (i(t) * L(t))

-- in other words, accept that both current and inductance change with
time, and take the derivative of the pair.  The place to look to check
up on my assumption is texts in electrical machines (it's a 3rd-year
electronics course.  My book is "Electric Machines: Steady-State Theory
and Dynamic Performance" by Mulukutla S. Sarma, WCB, 1985.

Note that, at best, you'll have to treat the system as a time-varying
linear system, and you may have to treat the system as being nonlinear
(depending on how quickly the solenoid position varies with time
compared to the current).  You'll also see that finding the inductance
vs. position relationship is (ehem) left as an exercise to the reader.

This isn't a complete answer, but I hope that it sets your feet on the
right road.

-- 

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


Re: [Scilab-users] captions too long

2015-09-20 Thread Tim Wescott
If I'm writing a paper then I generally put very terse captions or (more
usually) no captions on the plots, then use whatever editor I'm using
(usually Lyx/LaTeX these days) to caption the plot "properly".

However, sometimes I need to email just a plot to someone -- to convey
"see it works!" or "this is how disaster is striking".

Is there a way to put a linefeed into a caption for those times, or a
block of text?

On Sun, 2015-09-20 at 15:49 +0200, Samuel Gougeon wrote:
> Hello,
> Le 20/09/2015 11:14, Da Feng a écrit :
> 
> > Hi:
> >   I'm using plot() and find that if the caption is too long, then
> > part of it can't be seen. If I resize the figure and turn off
> > auto_resize, then part of the captions is still not drawn. But if I
> > turn on auto_resize, then the figure enlarges, and the captions is
> > still too long. What should I do?
> shorten the caption, as using a reference as caption and give its full
> text elsewhere, or reduce its font size.
> 
> For a certain plot, there will always be a length for its caption that
> will require more space than the plot itself. So, you have to chose
> what should take most place: the plot or its caption.
> This is why one couldn't advice you to decrease the margins sizes.
> 
> HTH
> Samuel
> 
> _______
> 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


Re: [Scilab-users] animation of multiple plots

2015-09-15 Thread Tim Wescott
I cannot remember the name of the application, but there is software out
there that will take a number of static images and compile them into
mpeg or other "movie" format.

I've done it, but it was long ago on a computer far, far away.  I'd have
to google for it, and my Google Fu is not something to write home about
-- try some variation on "animated movie from stills" or "jpeg to mpeg"
or some such.

On Tue, 2015-09-15 at 15:57 +0200, grivet wrote:
> 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)
>  update trajectory: he2.children(1).data = [x(t(1:i)),y(t(1:i))]
>  subplot (1,2,2)
>  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.
> 
> 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
> 
> 

-- 

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


Re: [Scilab-users] Identifying parameters of a multy frequency damped oscillation

2015-09-08 Thread Tim Wescott
On Mon, 2015-09-07 at 14:26 +0200, Jens Simon Strom wrote:
> Hi Scilab users, I want to analyse a microphone recording of the sound
> of a bell or gong. Given ia the equidistantly sampled sound pressure
> y(t) after a stroke for 10 s.
> 
> The ansatz 
> 
> y=sum(  A_i*exp(-d_i*t))*cos(2*%pi*f_i+alpha_i)  )  for i=1,2,...5 or more
> 
> is assumed to approximate the signal where A_i, d_i, f_i, and alpha_i
> are the unknown amplitudes, danping factors, frequencies, and phase
> angles of y. The analysis may be restricted to the lowest 5 frequencies
> fi.

> Does Scilab offer a method for this? FFT seems not to be adequate
> because the signal is aperiodic (silence after 10 s).

> Is nonlinear regression (with which I'm fmiliar) a promising way. The
> lowest frequencies can probably be concluded from a short time DFT
> where damping is negligible.

Hey Jens:

I'm not sure that a gong or a bell that's not "tuneful" (e.g. a cowbell,
as opposed to a church bell) would have components that are well-enough
separated to be easily picked out by any numerical analysis -- but I'm
ready to be proven wrong.  Certainly it should be possible to pick out
the components of a bell that might be used for making music.

I would start with an FFT to get rough values for the f_i and alpha_i.
Then I would use those as starting points for nonlinear regression.

Alternately, if the components are well-enough separated in the FFT of
the captured audio you could identify each component, then for each
component you could zero out the FFT outside of that component's
contribution (remember to retain both positive and negative frequency
components symmetrically around 0Hz), then do an IFFT to get the
waveform for just that component.  This _might_ recover each individual
component well enough that you can eyeball it for A_i and d_i -- at
which point you could either call it good enough, or you could make an
even better starting point for your regression analysis.

-- 

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


Re: [Scilab-users] Regarding a error message "List element number 13 is Undefined."

2015-08-31 Thread Tim Wescott
On Mon, 2015-08-31 at 17:49 +0530, Parthageet Samantaray wrote:
> Hello all,
> 
> 
> I am having problem while running the simulation in Xcos. Actually I
> am trying to simulate a closed loop system. The model was working till
> it was open loop, with considered inputs. But as I connect a feedback
> path it is showing a message on the Scilab console - "List element
> number 13 is Undefined."
> 
> 
> I attempted to make the feedback path in many ways but nothing worked
> out. I am unable to understand why this error is displaying.
> 
> 
> If anyone has any suggestions kindly post me.

Post your xcos file.  This won't help me help you, but someone who knows
more than I do about xcos will probably need it.

If you can't because it's huge or proprietary, try trimming bits out --
if the problem persists when it's small and simple, that'll make an even
better thing to post.  If the problem goes away when you excise some
specific block, then you can consider that a huge blinking arrow to the
problem.

-- 

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


Re: [Scilab-users] Reading Gerber files and exporting g-code for cnc

2015-07-30 Thread Tim Wescott
On Thu, 2015-07-30 at 16:30 -0700, PabloF wrote:
 Hi:
 I want to read a gerber file with scilab, process it and export a gcode file
 for using with a custom cnc we build in our university, for manufacturing
 PCB's with isolation method.. But i'm looking for advice.
 
 By now, i've meade a script to read each line from a gerber file, and i use
 select-case to parse them... i can handle basic appertures (circles and
 rectangles) and do linnear interpolations by the momment..
 The main idea is to draw a binary image with the information of the gerber
 file and then do some image processing to get the edges of the image (with a
 sobel's filter or something).
 
 The gerber specifications states that for tracks, i need to stroke or paint
 the arc or line with the selected apperture.. so i made a function that
 paints the shape of the apperture with center in a given coordinate of a
 matrix. For stroking a line for example, i should call this function for
 each coordinate of the interpolated line... I've done this but the process
 is too slow... Is there any simpler aproach?
 
 Then, once i have the edges of the image, i don't know how to select the
 coonvinient coordinates of the detected edges so that i can export a g-code
 with them... for example, if i have to do a circle, i should give many
 points of the circle and form lots of tiny lines as an approximation, but if
 i have to do a line, i should only use 2 points.. I think this points can be
 detected with a corner filter, and then i should reorder them... any ideas
 of this? I want to do the circles with little lines so i get a simpler
 g-code for our custom cnc
 
 Any ideas would be welcome! thanks

Before I did anything else, I'd look around to see if there were a board
aggregator in my economic zone from whom I could buy boards.  In the US
there's OshPark who'll sell you three N-square inch boards for N*$5, and
there's a number of shops in China that do this, possibly for less.

If I were bound and determined to route out boards, rather than trying
to make an image and then do image processing on that, I'd make an
algorithm that can tell if your router bit is in some copper, in the
clear, or on the boundary of some copper.  Then I'd either make it
follow that boundary (without, of course, cutting into any other bits of
copper), or I'd just scan the bit across the board, only cutting when
I'm free of copper.  The first way will be prettier, the second way will
be easier.

Finally, in spite of the fact that this is a Scilab group -- don't do it
in Scilab.  Scilab is great for things that use it's built-in matrix
handling capabilities, but when you step outside of that you'll be much
better off programming in C or some such.

-- 

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


Re: [Scilab-users] Auto tuning in xcos

2015-07-09 Thread Tim Wescott
On Thu, 2015-07-09 at 06:22 -0700, Sayni Sana wrote:
 Hi I am sayni. I am trying to do pid tuning of a system of inverted
 pendulum in xcos platform. But the problem that is arriving is unlike
 auto tuning which can be done in simulink platform in matlab it cannot
 be done here. The values of kp, kd, ki does not come automatically on
 choosing the block of pid and the there is no option of tuning the
 plant.  Does anyone has or knows a solution to this? I am actually
 doing a thesis for which this is required. 

I'm not clear on what you're looking for here -- do you want a block
that does auto-tuning, or are you unable to figure out how to enter the
gains into the PID block that's there?

-- 

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


Re: [Scilab-users] Redefined function does not remain redefined in macro

2015-06-24 Thread Tim Wescott
On Mon, 2015-06-22 at 02:31 -0700, DominicErnst wrote:
 Dear all,
 
 I stumbled across a strange behavior I don't understand correctly.
 Please also refer to the simplified code extract below.
 
 Apparently beta(x,y) refers to a built in SciLab function (beta function
 (Euler integral of the first kind)). If I redefine the function by a simple
 vector variable, I obviously get the warning that the function was redefined
 (funcprot(1)). Which is what I would expect.
 
 Now, if I try to write-access a particular value in this now initialized
 vector I get the Warning Warning: obsolete use of '=' instead of '=='.. To
 my understanding, this happens as scilab still interprets the function as
 the default function beta and not the redefined vector.
 
 Is there any way to circumvent this? Or am I forced to choose another
 variable name?
 
 Example code snippet:
 
 clc;
 clear;
 funcprot(1);
 
 b = 2;
 
 p= linspace(0,20,10)';
 
 beta= zeros(1:10)';
 
 for i = 1:length(p)-1 do
 a(i)= b*cos(beta(i)/2);
 beta(i+1)= p(i+1)*a(i);
 end
 
 Any help is greatly appreciated
 
 Best,
 
 Dominic

Hey Dominic:

Yes, I think it's a bug.  However, I'm of the opinion that redefining
built-ins in your code is in Very Bad Style.  You've had the suggestion
to use Beta -- I'd use beta_, or b, or something else that avoids
depending on capitalization to keep track of stuff (because I also think
that is Very Bad Style).

Do keep in mind that this is probably a quibble unless you're writing
applications that need to be maintained by other people, or big
applications that need to last over half a year (I find that after half
a year of not looking at some piece of my own code I count as other
people when I get back to it).  But -- it's a good habit to get into.

-- 

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


Re: [Scilab-users] eigs calculation

2015-06-19 Thread Tim Wescott
On Fri, 2015-06-19 at 08:49 +, Carrico, Paul wrote:
(top posting fixed)
 -Message d'origine-
 De : users [mailto:users-boun...@lists.scilab.org] De la part de Serge Steer 
 Envoyé : jeudi 18 juin 2015 10:08 À : users@lists.scilab.org Objet : Re: 
 [Scilab-users] eigs calculation
 
 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
Dear
 
 I've been reading all the advices that (all of them) speak about the
need to normalize the data in order to avoid the ill-conditioned issues
(and to be the closest as possible to the value 1.0) ; the example
shared by Serge Steer is quite interesting and highlights the
ill-conditioning issue.
 
 Nevertheless I'm a bit confuse on how to do it in order to rebuild the
results afterward:
 [u,v] = eigs(K((ddl_elem+1):$,(ddl_elem+1):$),M((ddl_elem+1):
$,(ddl_elem+1):$),n,SM); 
 
 pulse_ =sqrt(diag(u))//pulse - circular frequency
 freq_ = pulse_/(2*%pi);  //natural frequency
 
 Naively I thought that the following would have fix the problem:
 - using max(K) and max(M) to normalize the sparse matrix,
 - removing the smallest values (i.e. bellow a threshold value) 
 
 ... but the matrix becomes singular (why ?).
 
 So is there any additional advice ?
 
 Paul
 
Normalization refers to jiggering the numbers around in a way that
does not change the problem in a strictly mathematical sense, but which
makes it more tractable.

d = eigs(A, B) computes the solutions to

A * v = lambda * B * v

So any nonsingular square matrix N won't change the problem if it's
multiplied in:

N * A * v = N * lambda * B * v

Because lambda is a scalar (well, I hope I'm getting that right) you can
change the problem to

A_ = N * A, B_ = N * B, and

d = eigs(A_, B_)

will, theoretically, get the same answers as with the original matrices,
but possibly with better numerical conditioning.  This is what you're
doing when you change units.

If you don't mind the meaning of your eigenvectors changing, you can do
a similarity transform.  Start with

N * A * N^(-1) * N * v = N * lambda * B * N^(-1) * N * v

Now set

A_ = N * A * N^(-1)
B_ = N * B * N^(-1)
v_ = N * v

[d, v_] = eigs(A_, B_); v = N^(-1) * v_;

will, again, theoretically give you the same numbers as before, but it
may be better conditioned numerically.

Actually _finding_ N, or giving you advise on how to do so, is beyond my
powers -- but maybe this will set you on a better road.

-- 

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


Re: [Scilab-users] equivalent to eigs in scilab

2015-06-10 Thread Tim Wescott
On Wed, 2015-06-10 at 23:11 +0200, paul.carr...@free.fr wrote:
 Dear All
 
 I get a Matlab file and I would like to know what is the equivalent to
 
 Matlab:
 n = 6;
 [u,v]=eigs(K,M,n,'SM'); // where K and U and 2 sparse matrix
 //'SM' means Smallest for my understanting - looking 
 for the 6th lower eigen values, isn't it ?
 
 Scilab:
 Spec or bdiag seems to be equivalent, but I failed in using them 
 
 How should I to proceed ?
 
 Thanks
 
 Paul

spec (short for spectrum):

--A = rand(3,3,n)
 A  =
 
0.3501626  - 1.40619260.5546874  
1.0478272  - 1.0384734  - 0.2143931  
  - 1.3218008  - 1.7350313  - 2.0735088  
 
--spec(A)
 ans  =
 
  - 0.2010690 + 1.3816266i  
  - 0.2010690 - 1.3816266i  
  - 2.3596815   
 
-- 

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


Re: [Scilab-users] advice on a pseudo-bandwidth calculation

2015-06-09 Thread Tim Wescott
On Tue, 2015-06-09 at 14:36 +, Carrico, Paul wrote:
 Dear all
 
  
 
 I’m currently thinking  in a way to compare experimental have a bell
 shape, composed of points and not connected to any parametric curve
 (the bell shape assumption could answer to the need in a first step).
 
  
 
 A way I can imagine is to calculate a kind of “ bandwidth” (-3 db).
 
  
 
 I add a look in the Scilab help but nothing obvious appears
 
  
 
 what is the best way to proceed to:
 
 - calculate/determine the intersection points with the
 “pseudo”-curves,
 
 - the number of points may change and may have different abscissa ?
 
 - the points could not necessarily by expressed by a parametric curve
 (to fit on before calculating the intersection),
 
  
 
 Any suggestion are welcome
 
  
 
  
 
 NB: please find hereafter a basic example using a gauss curve (just to
 illustrate the purpose)
 
To the extent that you can do so without giving away any proprietary
information, could you please tell us what you're really trying to do?

Citing a Gaussian distribution (a bell curve) implies that you're
trying to find a probability density, but citing a bandwidth implies
that you're trying to characterize some sort of a signal processing
system.  Those two concepts don't exactly fit well together when you're
talking of one set of data.

If you're taking a bunch of measurements and you're assuming a Gaussian
distribution of errors, and you want to estimate the mean and variance
of the distribution, then you want to use mean(x) and var(x).  This is
kind of the quick  dirty way to do things, but with a large enough
sample it's not going to be very far off the mark (if you have less than
a couple of dozen samples you may want to investigate the Student t
distribution, but I don't like recommending it if you don't have a solid
background in statistics).

-- 

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


Re: [Scilab-users] Building on 32 bit Ubuntu 15.04

2015-06-03 Thread Tim Wescott
For my locally-installed Scilab I have a file at /usr/local/bin/scilab
which is marked executable and which reads:

#!/bin/bash

/usr/local/share/scilab-5.5.1/bin/scilab $*

It isn't pretty, but it works.

On Thu, 2015-06-04 at 09:38 +1000, Brenton Horne wrote:
 Hi, 
 
 I have tried to install Scilab 5.5.2 on my Ubuntu machine from source
 code. Now I know there's a binary but I want an installation that
 creates a /usr/bin/scilab file so that the command 'scilab' launches
 the Scilab GUI. I have tried creating a symbolic link (via sudo ln
 -s /path/to/scilab-5.5.2/bin /usr/bin/scilab) to allow this but for
 whatever reason running 'scilab' from the command line won't seem to
 launch the Scilab GUI after I create such a link. 
 
 My build attempt may be summarized by this bash script (before this
 script was when I downloaded the source tarball and the prerequisite
 tarball to Downloads using Chrome):
 cd ~/Downloads for i in *.tar.gz do sudo tar xvzf $i -C /opt;
 done sudo chmod 777 -R /opt/scilab-5.5.2 cd /opt/scilab-5.5.2
 sudo ./configure sudo make all
 ​
 no errors were encountered up until the last line, the last six lines
 of output were:
 Found dependency from scilab-cli-bin to libstdc++ found
 Makefile:2092: recipe for target 'check-libstdcpp-dep' failed
 make[1]: *** [check-libstdcpp-dep] Error 2 make[1]: Leaving
 directory '/opt/scilab-5.5.2' Makefile:1541: recipe for target
 'all-recursive' failed make: *** [all-recursive] Error 1
 ​
 If it is important I have been trying to follow the Compiling Scilab
 5.x under GNU-Linux Unix Wiki article and to get any prerequisites
 not in the tarball I ran:
 sudo apt-get build-dep scilab
 
 ​
 The version of Scilab found in the vivid repos is 5.5.1 so I thought
 that the dependencies for 5.5.2 would be similar enough to allow
 Scilab 5.5.2 to be built using 5.5.1's dependencies. 
 
 Thanks for your time,
 Brenton
 
 ___
 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


Re: [Scilab-users] New computer, graphics(?) crashes

2015-06-03 Thread Tim Wescott
I just installed Xubuntu, 14.04, 64 bit.  Even without the fglrx
drivers, it's faster and it doesn't seem to crash (at least, it's 570
seconds into a simulation, with tons of updates to the monitor graph,
without problem).

Thank you all.

On Wed, 2015-05-27 at 08:15 +0300, Nikolay Strelkov wrote:
 Dear Tim!
 
 For me it seems that you need to use proprietary AMD drivers - fglrx.
 Open drivers are buggy and show low-performance.
 
 If you want to use open driver on Ubuntu 12.04 LTS (precise) you
 should upgrade its HWE to 14.04 LTS (trusty).
 
 With best regards,
 Nikolay.
 
 
 27 мая 2015 г. 3:22 пользователь Tim Wescott t...@wescottdesign.com
 написал:
 Running a Scilab algorithm that puts up a lot of graphs,
 Scilab crashes
 with the report below.  It's only happened with Scilab, but it
 appears
 to be the video driver that's complaining, so I don't know if
 this is a
 problem with Linux or with Scilab.  The processor is an AMD
 A10 with
 on-board video processing which is considerably different from
 my
 12-year-old Dell that this computer is replacing.
 
 Does anyone have clues for the clueless?  Particularly
 suggestions for
 isolating, fixing, or working around the problem?
 
 radeon: Failed to allocate a buffer:
 radeon:size  : 3328 bytes
 radeon:alignment : 256 bytes
 radeon:domains   : 2
 EE ../../../../../../src/gallium/drivers/radeon/r600_texture.c:1012
 r600_texture_transfer_map - failed to create temporary texture
 to hold
 untiled copy
 radeon: Failed to allocate a buffer:
 radeon:size  : 1280 bytes
 radeon:alignment : 256 bytes
 radeon:domains   : 4
 radeon: Failed to allocate a buffer:
 radeon:size  : 1 bytes
 radeon:alignment : 1 bytes
 radeon:domains   : 2
 radeon: Failed to allocate a buffer:
 radeon:size  : 1 bytes
 radeon:alignment : 1 bytes
 radeon:domains   : 2
 Segmentation fault (core dumped)
 
 
 --
 
 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

-- 

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


Re: [Scilab-users] Accidentally displaying huge matrices

2015-05-27 Thread Tim Wescott
With the caveat that the threshold size that determines what gets
displayed in its entirety and what doesn't is tunable, this works for
me.

The root problem that I'm addressing is the pitfall of doing something
that prints for ever and ever just because I forgot the ';'.

On Wed, 2015-05-27 at 09:41 +0200, Serge Steer wrote:
 For me displaying a huge matrix (or huge structure) on the screen has in
 general no interest. So it should be convenient to display only its size
 and type as it is done when displaying a struct which contain a large array:
 --S.A=rand(1000,1000)
 S  =
  
A: [1000x1000 constant]
 This solution can be set as a default display mode, keeping others as
 options.
 
 Serge Steer
 
  25/05/2015 15:29, Antoine Monmayrant a écrit :
   
  Le Samedi 23 Mai 2015 00:05 CEST, Samuel Gougeon sgoug...@free.fr a 
  écrit: 
   
  Hello Tim,
 
  Le 21/05/2015 17:48, Tim Wescott a écrit :
  .../...
  First, is there a way to get it to stop?  ctrl-C does not do the job.
  In your startup file .scilab or scilab.ini, you may add the instruction
  lines(1000)
  in order to turn on the pager and make it prompting the user to continue 
  listing lines after each block of 1000 lines (or whatever you want).
  At the prompt, CTRL+C + abort works.
  OK, but this also interrupts the execution of any script that display more 
  than 1000 lines on the command line!
  This can be particularly annoying when using scripts that process big data 
  and  output some progression infos on the command line.
  It's never nice to find out the next morning that your script stopped at 
  10% to ask whether it should keep on displaying text.
  For me, this is more a workaround (with one big caveat) than a real 
  solution.
  The Julia way of displaying big matrices seems interesting.
  Would it be hard to implement?
  (honest question, I have no idea what work it implies)
  As someone filled a bug/feature request?
 
  Cheers,
 
  Antoine
 
  Regards
  Samuel
 
  ___
  users mailing list
  users@lists.scilab.org
  http://lists.scilab.org/mailman/listinfo/users
 
   
   
   
   
 
 
  ___
  users mailing list
  users@lists.scilab.org
  http://lists.scilab.org/mailman/listinfo/users
 
 ___
 users mailing list
 users@lists.scilab.org
 http://lists.scilab.org/mailman/listinfo/users

-- 

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


Re: [Scilab-users] New computer, graphics(?) crashes

2015-05-27 Thread Tim Wescott
Strike that, I'm running 12.04.  Dang.  Time to upgrade, I guess.

On Wed, 2015-05-27 at 08:15 +0300, Nikolay Strelkov wrote:
 Dear Tim!
 
 For me it seems that you need to use proprietary AMD drivers - fglrx.
 Open drivers are buggy and show low-performance.
 
 If you want to use open driver on Ubuntu 12.04 LTS (precise) you
 should upgrade its HWE to 14.04 LTS (trusty).
 
 With best regards,
 Nikolay.
 
 
 27 мая 2015 г. 3:22 пользователь Tim Wescott t...@wescottdesign.com
 написал:
 Running a Scilab algorithm that puts up a lot of graphs,
 Scilab crashes
 with the report below.  It's only happened with Scilab, but it
 appears
 to be the video driver that's complaining, so I don't know if
 this is a
 problem with Linux or with Scilab.  The processor is an AMD
 A10 with
 on-board video processing which is considerably different from
 my
 12-year-old Dell that this computer is replacing.
 
 Does anyone have clues for the clueless?  Particularly
 suggestions for
 isolating, fixing, or working around the problem?
 
 radeon: Failed to allocate a buffer:
 radeon:size  : 3328 bytes
 radeon:alignment : 256 bytes
 radeon:domains   : 2
 EE ../../../../../../src/gallium/drivers/radeon/r600_texture.c:1012
 r600_texture_transfer_map - failed to create temporary texture
 to hold
 untiled copy
 radeon: Failed to allocate a buffer:
 radeon:size  : 1280 bytes
 radeon:alignment : 256 bytes
 radeon:domains   : 4
 radeon: Failed to allocate a buffer:
 radeon:size  : 1 bytes
 radeon:alignment : 1 bytes
 radeon:domains   : 2
 radeon: Failed to allocate a buffer:
 radeon:size  : 1 bytes
 radeon:alignment : 1 bytes
 radeon:domains   : 2
 Segmentation fault (core dumped)
 
 
 --
 
 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

-- 

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


[Scilab-users] Accidentally displaying huge matrices

2015-05-21 Thread Tim Wescott
If you're working with something humongous and you do some operation
that displays, it takes forever before your mistake is done displaying.

E.g., if x is 10 elements long and you type

y = exp(x)

instead of 

y = exp(x);

So I have two questions:

First, is there a way to get it to stop?  ctrl-C does not do the job.

Second, if not, could someone file an enhancement request, or remind me
how to do it?

TIA

-- 

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


Re: [Scilab-users] periodical X-Axis in 2d plot

2015-05-12 Thread Tim Wescott
On Tue, 2015-05-12 at 20:42 +0200, Samuel Gougeon wrote:
 Hello,
 
 Le 12/05/2015 18:46, Tim Wescott a écrit :
  On Tue, 2015-05-12 at 06:55 +0200, Philipp Mühlmann wrote:
  .../...
 
  If you look at x_ticks.labels you'll see that it's just a matrix of
  numbers, located as specified in x_ticks.locations (so you can move the
  ticky marks, too).  I did:
 
  --g.children.x_ticks.labels = ['bob' 'mary' 'ralph' 'sue' 'yassar'
  'george' 'jean' 'osama' 'francis' 'molly']';
 Let's be aware that this syntax is possible only if the number of major 
 ticks is unchanged.
 For the general case, the processing is fully documented in
 help axes_properties // 
 http://help.scilab.org/docs/5.5.2/en_US/axes_properties.html
 in the section x_ticks, y_ticks, z_ticks.
 
Thanks for the link -- my solutions are often rough  ready, because I'm
not good at finding stuff in the documentation.

-- 

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


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

2015-04-24 Thread Tim Wescott
Heh.  This is much better than my suggested method, both in speed and in
resulting in a well-defined envelope.  I'll have to remember it.

On Fri, 2015-04-24 at 21:03 +0200, Samuel Gougeon wrote:
 Hello,
 Le 24/04/2015 14:05, paul.carr...@free.fr a écrit :
 
  Dear All,
  
  I am absolutly not familiar with signal processing field, so my question 
  is probably naïve: how can I proceed to get the envelop curve (maximum 
  values) of a non periodic noisy signal ?
 Here is an example and its result:
 x = linspace(0,20,300);
 y = exp((2-x)/5).*sin(x)+rand(x);
 
 clf
 plot2d(x,y)
 e = gce();
 e = e.children;
 e.foreground = color(grey80);
 
 d = diff(y) ./ diff(x);
 pmax = find(d(1:$-1)=0  d(2:$)0)+1;
 pmin = find(d(1:$-1)0  d(2:$)0)+1;
 // edges corrections
 if d(1)0 then
 pmax = [1 pmax]
 end
 if d($)0 then
 pmin = [pmin length(y)]
 end
 //
 plot(x(pmax),y(pmax),r,x(pmin),y(pmin),b)
 
 Zooming on that shows in some places the limits of this naive
 approach, to be refine.
 
 Regards
 Samuel
 
 
 ___
 users mailing list
 users@lists.scilab.org
 http://lists.scilab.org/mailman/listinfo/users

-- 

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


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

2015-04-24 Thread Tim Wescott
It sounds like he's looking for the digital equivalent of what would
come out of a diode detector in an AM radio -- the Hilbert transform
isn't going to help much, there.

On Fri, 2015-04-24 at 13:36 +0100, Mike Page wrote:
 Hi Paul,
 
 
 Usually the envelope is calculated via the magnitude of the Hilbert
 transform.  Check out Hilbert in the help.  As usual there are some
 caveats, but often this is close enough without further work.
 
 
 HTH,
 
 Mike.
 
 
 
 On 24 April 2015 at 13:05, paul.carr...@free.fr wrote:
 Dear All,
 
 I am absolutly not familiar with signal processing field, so
 my question is probably naïve: how can I proceed to get the
 envelop curve (maximum values) of a non periodic noisy
 signal ?
 
 Thanks for any suggestion
 
 Have a good WE
 
 Paul
 ___
 users mailing list
 users@lists.scilab.org
 http://lists.scilab.org/mailman/listinfo/users
 
 
 ___
 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


Re: [Scilab-users] Ways to speed up simple things in Scilab ?

2015-04-24 Thread Tim Wescott
If A stays constant this should work well.

Yes, doing this as a C call will speed things up, too, but if you can do
it with matrices and no C calls your code may stand the test of time
better.

What seems to work for me is to keep in mind that Scilab tends to be
slow with individual operations, but without much of a speed hit for
matrix operations.  So any place that you can replace a 'for' loop or
string of statements with a matrix operation, you can save time.

On Fri, 2015-04-24 at 14:50 +0200, Stéphane Mottelet wrote:
 Hello Antoine 
 
 
 I think your idea is excellent in my context, I Will try it and keep
 you informed of the actual improvement,
 
 
 S.
 
 Le 24 avr. 2015 à 13:31, Antoine Monmayrant
 antoine.monmayr...@laas.fr a écrit :
 
 
  Hi again,
  
  Another way you might improve your code: can you write it as a
  matrix-vector product?
  Like
  
  M1_v=A*v; 
  Where A is a matrix of size (839,172) that corresponds to your weird
  combination of v(i) to build M1_v.
  It seems to me that you should be able to write it that way, which
  would save a lot of time as matrix product are fast in Scilab.
  
  Antoine
  
  
  Le 04/23/2015 11:51 PM, 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 ? 
   
   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
  
 ___
 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


Re: [Scilab-users] Display problem

2015-04-22 Thread Tim Wescott
On Wed, 2015-04-22 at 06:07 +, SCHULZ Wolfgang wrote:
 Hello,
 I would like to display 10e6 points but it seems that Scilab (5.2.2 x64 on 
 Win7) works only till 8e6 points.
 
 I tried increasing the Java Heap memory (and restarted Scilab afterwards) but 
 there was no effect.
 
 Here is a test program what works till 8e6 but doesn't work for 9e6.
 
 stacksize('max')
 Maximum=8e6
 dt=1/Maximum;
 t=0:dt:1;
 y=sin(2*%pi*50*t);
 plot(t,y);
 
 Any idea what could be wrong?

While you're waiting to get the bug fixed, have you pondered the
impossibility of displaying X values in Y spaces when X  Y?  Unless
you've got something astonishing, your display has, at most, only a few
thousand pixels across, so there's no way you can display 10e6 points
anyway.  The same holds for any normal page-sized sheet and printer
(although I suppose you could manage this with a 300mm silicon blank and
some state-of-the-art lithography).

If your function is continuous, then doing

plot(t(1:100:$), y(1:100:$))

will give you a pretty close approximation, and still use way more
points than your display can handle.  If you're looking for glitches
then you'll have to do something fancier (and more challenging as far as
memory usage).

-- 

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


[Scilab-users] Large variables and execution speeds

2015-02-24 Thread Tim Wescott

I have an algorithm that I'm working on that involves having large data
sets, which I'm currently representing as tlists.  Due to the
constraints of the algorithm, I'm doing many calls that are more or less
of the form:

my_tlist = some_function(my_tlist);

The intent is to get the same effect that I would get if I were in C or
C++, and wrote:

some_function( my_structure);

or

my_class.some_function();

It appears, from the significant loss of execution speed when I do this,
that Scilab is copying the results of the function into the my_tlist
variable byte by byte.

At this writing, the only way that I can see to fix this is to invoke
the function as:

some_function(my_tlist);

and then wherever I modify data have use an exec function, i.e., replace

local_tlist.some_field = stuff;

with

exec(msprintf(%s = stuff, local_tlist_name));

This seems clunky in the extreme.

Is there another way to do something like this that doesn't force Scilab
to copy large chunks of data needlessly, but allows me to operate on
multiple copies of similar tlists?

Thanks.

-- 

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


Re: [Scilab-users] plotting 2 robots in same graphic

2015-02-23 Thread Tim Wescott
On Mon, 2015-02-23 at 19:34 +, hvn wrote:
 Hi,
 
 I'm using v 5.5.1 with the Robotics Toolbox and want to display 2 
 manipulators in the same graphic. Following the Help and the Toolbox 
 demo, I write this code:
 
 //define links
 L1 = Link('d',0,'a',1,'alpha',%pi/2);
 L2 = Link('d',0,'a',1,'alpha',%pi/4);
 L3 = Link('d',0,'a',1,'alpha',%pi/3);
 L4 = Link('d',0,'a',1,'alpha',%pi/5);
 
 // create lists
 La = list(L1, L2);
 Lb = list(L3, L4);
 
 //couple and create robots
 bot1 = SerialLink(La, 'name', 'bot1');
 //bot2 = SerialLink(Lb, 'name', 'bot2','base',transl(-1, 1, 0));
 
 //define end effector positions
 pos1 = [0.1 0.2];
 pos2 = [0.2 0.8];
 
 // draw robots
 plot_robot(bot1, pos1);
 bot2 = SerialLink(Lb, 'name', 'bot2','base',transl(-1, 1, 0));
 plot_robot(bot2, pos2)
 
 ending up with 1 manipulator in 1 graphic. What do I do wrong ?

I have no direct experience with that toolbox, but if you're ending up
with a drawing of the second bot's manipulator each time, plot_robot
probably clears the figure before plotting.

A quick tour of the plot_robot code may tell you if that's happening.
It's probably in a file called plot_robot.sci, if the authors of the
toolbox have adhered to the naming conventions.

If there's a way of plucking the contents out of one graphic and
inserting them into another that may be a work-around.  You'd have two
plots, but at least one would have what you want.  I don't know if that
is possible -- but I'd ask the question here, and see what response I
got.

-- 

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


Re: [Scilab-users] installing latest scilab (5.5.1) version on udoo

2015-01-16 Thread Tim Wescott
Does Udoo have a graphical user's interface?  Does it have Synaptic
Package Manager?  If so, search on JOGL (you probably need the source)
and install it.

If not, then go on a web-walk and figure out how to do the same thing
using Aptitude.  You'll need to search for the right package the install
it using 

sudo apt-get install package name.  

Synaptic is just a convenient graphics interface to apt-this and
apt-that (It's for dummies like me).  Anything you can do from Synaptic
you can do from the command line -- probably better.

You may also want to see if there appears to be a package
(pseudo-package?) that has all the dependencies needed to build Scilab
for Debian.  There ought to be one, but that doesn't mean that someone
turned the ought to be into an is.

On Fri, 2015-01-16 at 02:54 -0700, pkk wrote:
 hi,
 
 when I add deb http://ftp.de.debian.org/debian jessie main 
 to  /etc/apt/sources.list, then sudo apt-get update
 the udoo packs up and I need reinstall the OS...
 
 When trying to install scilab from source, using 
 apt-get build-dep scilab
 for the dependancies gives not error.
 
 Trying ./configure it hangs on the following error: libjogl: LIbrary missing
 (cannot find symbol gLTextParameterf). Check if libjogl - C/Java (JNI)
 interface for JOGL2 - or libGL (OpenGl library) are installed and if the
 version is correct. Note you may have to update etc/librarypath.xml to
 provide path to JNI librarier.
 
 How can I install JOGL2 or libGL and update the librarypath.xml correctly?
 
 THANK YOU!
 
 
 
 
 
 --
 View this message in context: 
 http://mailinglists.scilab.org/installing-latest-scilab-5-5-1-version-on-udoo-tp4031606p4031640.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
 

-- 

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


Re: [Scilab-users] installing latest scilab (5.5.1) version on udoo

2015-01-09 Thread Tim Wescott
On Fri, 2015-01-09 at 12:36 +0100, Antoine Monmayrant wrote:
 On 01/06/2015 11:44 PM, Tim Wescott wrote:
  Hey Patrick:
 
  What you want to do is uninstall Scilab from Ubuntu, and hand install
  it.
 
  This can be very easy, if you don't mind not having a shortcut in your
  start menu.  I use Lubuntu, so the following directions should work for
  you, more or less (with the caviat that I'm no sysop).
 
  * Download the tar
 
 Hmm, the UDOO is an Arm platform.
 I don't think there is a precompiled tar of scilab for this kind of CPU.
 Did anyone try to compile scilab from source on an Arm machine?
 
Whoops -- I missed that detail.  Sorry for passing inaccurate
information.

-- 

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


  1   2   >