Re: [Scilab-users] Optimization

2018-10-25 Thread CRETE Denis
Hello
Is this any better ?
Out=[];
for im=1:3,
alpha=tokens(M(im,6));
numbers=tokens(M(im,7));
for jm=1:size(alpha,'r'),
Out=[Out;[M(im,1:5),alpha(jm),numbers(jm)]];
end;
end;

Note : I dont know of any repeat_vector_string function that would be useful to 
eliminate the inner loop: Out=[Out; [ 
repeat_vector_string(M(im,1:5),size(alpha)),alpha,numbers]]
(equivalent of kronecker operator for strings...)

HTH
Denis

De : users [mailto:users-boun...@lists.scilab.org] De la part de FIXED-TERM 
Nacer Mohamed Ikbal (ETAS/ESY)
Envoyé : jeudi 25 octobre 2018 15:53
À : users@lists.scilab.org
Objet : [Scilab-users] Optimization

Hi,

I have a simple task to split a element of a matrix into rows where remaining 
columns are duplicated. I have achieved that with loops.
I am sure there is an efficient way to do it using matrix functions. Can you 
please help?

The data contains both numbers and strings
the column 6 and 7 has equal numbers of elements delimited by '~'


Given Matrix

1  2  3  4  5  a~b~c~d  
 111~222~333~444
4  5  6  7  6  e~f~g~h~i 
555~666~777~888~999
8  9  10 11 12 j~k~l~m
112~223~334~445
.
.

Output after processing

1  2  3  4  5  a  111
1  2  3  4  5  b  222
1  2  3  4  5  c  333
1  2  3  4  5  d  444
4  5  6  7  6  e  555
4  5  6  7  6  f   666
4  5  6  7  6  g  777
4  5  6  7  6  h  888
4  5  6  7  6  i   999
8  9  10 11 12 j   112
8  9  10 11 12 k  223
8  9  10 11 12 l   334
8  9  10 11 12 m 445
..
..
Mit freundlichen Grüßen / Best regards

Mohamed Ikbal Nacer

Engineering of Systems (ETAS/ESY)
Tel. +49 711 3423-0 | Fax +49 711 3423-300 | 
fixed-term.mohamedikbal.na...@etas.com<mailto:fixed-term.mohamedikbal.na...@etas.com>

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


[Scilab-users] Optimization

2018-10-25 Thread FIXED-TERM Nacer Mohamed Ikbal (ETAS/ESY)
Hi,

I have a simple task to split a element of a matrix into rows where remaining 
columns are duplicated. I have achieved that with loops.
I am sure there is an efficient way to do it using matrix functions. Can you 
please help?

The data contains both numbers and strings
the column 6 and 7 has equal numbers of elements delimited by '~'


Given Matrix

1  2  3  4  5  a~b~c~d  
 111~222~333~444
4  5  6  7  6  e~f~g~h~i 
555~666~777~888~999
8  9  10 11 12 j~k~l~m
112~223~334~445
.
.

Output after processing

1  2  3  4  5  a  111
1  2  3  4  5  b  222
1  2  3  4  5  c  333
1  2  3  4  5  d  444
4  5  6  7  6  e  555
4  5  6  7  6  f   666
4  5  6  7  6  g  777
4  5  6  7  6  h  888
4  5  6  7  6  i   999
8  9  10 11 12 j   112
8  9  10 11 12 k  223
8  9  10 11 12 l   334
8  9  10 11 12 m 445
..
..
Mit freundlichen Grüßen / Best regards

Mohamed Ikbal Nacer

Engineering of Systems (ETAS/ESY)
Tel. +49 711 3423-0 | Fax +49 711 3423-300 | 
fixed-term.mohamedikbal.na...@etas.com


___
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 noguchi
Tim,

Thank you for your message.

I read datafit help several times. However, it is quite difficult for me to 
understand it.

> Model: ym(n)=ym(n-1)*amp+Kpm*bmp*u(n-1-Tdm)  where n=step=1:1:500)
> Where amp=exp(-Tsample/Taup), Tsample=1, bmp=1-amp
> Object function: sum of square of (y(n)-ym(n)) 

Variables to be changed to minimize the value of object functions are: Kp, Taup 
and Tdm

How should I write Scilab commands for this problem?


Thanks,


Y. Noguchi


- 元のメッセージ -
差出人: "Tim Wescott [via Scilab / Xcos - Mailing Lists Archives]" 

宛先: "noguchi" 
送信済み: 2016年3月26日(土曜日) 02:57:03
件名: Re: Optimization: First order delay and dead time TF model ID, CUTEr

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 
> [hidden email] 
> 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 





--
View this message in context: 
http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033862.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 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
>   
> 
> 
> 
> 
> 
> 
> --
> 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


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

2016-03-25 Thread noguchi
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
  






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


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

2016-03-21 Thread noguchi
Dear Harpreet,


Thank you for advise. It is little bit difficult for me to write down the
correct Scilab commands by only reading the datafit help.

Is following command right?   (ym(n)=ym(n-1)*amp+Kpm*bmp*u(n-1-Tdm)  where
n=step=1:1:500)


function y = FODDT(u,Kpm,Taum,Tdm,step,Tsamp)
amp=exp(-Tsamp/Taum);
bmp=1-amp;
[ym,amp,bmp]=ym(step-1)*amp+Kpm*bmp*u(step-1-Tdm)
endfunction

Don't we need to write the object function? Object function is minimize the
sum of error square = sum of (y(i)-ym(i))^2

How I should represent above equation in Scilab?

Thanks for your kind advise.

Best Regards,



--
View this message in context: 
http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033793.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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

2016-03-19 Thread Harpreet Singh Rathore
Hey,

Thats datafit for sure. Look at the help of datafit you will get to know
how to formulate.

Regards
Harpreet Singh

On Thu, Mar 17, 2016 at 7:39 PM, noguchi  wrote:

> Dear Harpreet,
>
>
> Thank you for advise.
>
> I am not familiar with fmincon or fminserach, I would like to start from
> simple objective function.
>
> First of all, I would like to identify the following parameters for SISO
> case:
>
> K, Tau, TD:   K/(Tau*s +1) * exp(-TD*s) =ymodel
>
> We have step test data, y (Process output) and U (process input).
>
> Object function: Min sum of ( (y-ymodel)^2)
>
>
> Could you please tell me how I can formulate my objective function using
> such optimization tool and foind optimum parameters?
>
> Thanks,
>
>
>
>
> --
> View this message in context:
> http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033776.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
>



-- 
Thanks and Regards
Harpreet Singh
___
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-19 Thread noguchi
Dear Mr. Serge,

Thanks for your advise.

Could you please advise me how I should formulate my problem using
fminserch?


Y. Noguchi



--
View this message in context: 
http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033755.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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

2016-03-19 Thread Harpreet Singh Rathore
You can use fmincon, present in atoms(external package which uses Ipopt).
Will you please tell me the dimension of the problem? Are you sure the
objective function is correct?Or is it some kinda datafitting problem? If
it is then please refer datafit which is already present in scilab.

Regards
Harpreet Singh

On Wed, Mar 16, 2016 at 7:16 PM, noguchi  wrote:

> Dear Mr. Serge,
>
> Thanks for your advise.
>
> Could you please advise me how I should formulate my problem using
> fminserch?
>
>
> Y. Noguchi
>
>
>
> --
> View this message in context:
> http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033755.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
>



-- 
Thanks and Regards
Harpreet Singh
___
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-18 Thread noguchi
Dear Harpreet,


Thank you for advise.

I am not familiar with fmincon or fminserach, I would like to start from
simple objective function. 

First of all, I would like to identify the following parameters for SISO
case: 

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

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

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


Could you please tell me how I can formulate my objective function using
such optimization tool and foind optimum parameters?

Thanks,




--
View this message in context: 
http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749p4033776.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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

2016-03-16 Thread noguchi
Hello, Scilab users,


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

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

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

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


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

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


Thanks.


Y. Noguchi



--
View this message in context: 
http://mailinglists.scilab.org/Optimization-First-order-delay-and-dead-time-TF-model-ID-CUTEr-tp4033749.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Optimization question

2014-08-18 Thread ebmb.sci
Dear Márton,
I am using these functions to identify the points A and B that minimizes (or
sometimes maximizes) this problem. Hence, I thought the optim could be the
best solution to do this, since I must explore the search space. However, as
said previously, using the intervals [0 1000] and [1 2000] I always get the
same results. Please, do you have any suggestions to help me?

Thank you so much for your attention!

Best regards,
Eduardo.



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


Re: [Scilab-users] Optimization question

2014-08-14 Thread ebmb.sci
 Dear Mottelet,
 thanks a lot for your tip. It was very valuable for follow with my work.
However, with the suggested modifications:

x0 = [0.01 1001];
[fopt, xopt] = optim(myFcCost, 'b', [0 1000], [1 2000], x0);

I always reaches the same results:

xopt = 0 2000
fopt = -6.480732e+02

 Please, could you help me again with this problem?

 Thanks in advance for your assistance!

 Best regards,
 Eduardo.




--
View this message in context: 
http://mailinglists.scilab.org/Optimization-question-tp4031028p4031034.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