Re: [Scilab-users] mlist parameters to a function call

2016-01-23 Thread eddydde
that's not the solution to my problem: 

the last two function calls in which i use xa(1x11) as first argument and
three parameters (a1.a2,a3 or d.aa(1,:)) !

here i get an 11x1 result with the wrong(?) three parameters

Ed.



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

2016-01-23 Thread Samuel Gougeon

Le 23/01/2016 10:34, eddydde a écrit :

that's not the solution to my problem:

the last two function calls in which i use xa(1x11) as first argument and
three parameters (a1.a2,a3 or d.aa(1,:)) !

here i get an 11x1 result with the wrong(?) three parameters

When xa is a vector,  T is a vector in the function, and then the line
 t=x(1)-x(2)/(T+x(3))
performs a matricial division. If you want to perform a element-wise 
division, the syntax is

 t = x(1) - x(2) ./ (T+x(3)) // with ./ instead of /

Regards
Samuel Gougeon

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


[Scilab-users] Conditional random variable

2016-01-23 Thread fujimoto2005
Is there any function generating random variable X with a standard normal
density conditional on a range (a,b] where 0http://mailinglists.scilab.org/Conditional-random-variable-tp4033320.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] extracting elements of a matrix

2016-01-23 Thread fujimoto2005
Let X be a m×n matrix and f(i) is a column index for the ith row.
I want to get a m×1 vector y where y(i)=X(i,f(i)) for 1<=i<=m.
Is there any method to get y other than  the following code?
for i=1:m
y(i)=X(i,f(i));
end

Best regards




--
View this message in context: 
http://mailinglists.scilab.org/extracting-elements-of-a-matrix-tp4033321.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] Conditional random variable

2016-01-23 Thread Stéphane Mottelet

Hello,

You will find the Matlab code for the "trandn" function there :

http://www.mathworks.com/matlabcentral/fileexchange/53180-truncated-normal-generator/content/trandn.m

hth

S.


Le 23/01/2016 13:25, fujimoto2005 a écrit :

Is there any function generating random variable X with a standard normal
density conditional on a range (a,b] where 0http://mailinglists.scilab.org/Conditional-random-variable-tp4033320.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] Conditional random variable

2016-01-23 Thread Stéphane Mottelet

You also have this distribution (and many more) in the atoms package

https://forge.scilab.org/index.php/p/distfun/

S.

Le 23/01/2016 13:25, fujimoto2005 a écrit :

Is there any function generating random variable X with a standard normal
density conditional on a range (a,b] where 0http://mailinglists.scilab.org/Conditional-random-variable-tp4033320.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] extracting elements of a matrix

2016-01-23 Thread Samuel Gougeon

Le 23/01/2016 17:43, fujimoto2005 a écrit :

Let X be a m×n matrix and f(i) is a column index for the ith row.
I want to get a m×1 vector y where y(i)=X(i,f(i)) for 1<=i<=m.
Is there any method to get y other than  the following code?
for i=1:m
y(i)=X(i,f(i));
end

Yes:
y = X((f-1)*m+i)

Regards
Samuel Gougeon

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


Re: [Scilab-users] extracting elements of a matrix

2016-01-23 Thread Samuel Gougeon

Le 23/01/2016 22:17, Samuel Gougeon a écrit :

Le 23/01/2016 17:43, fujimoto2005 a écrit :

Let X be a m×n matrix and f(i) is a column index for the ith row.
I want to get a m×1 vector y where y(i)=X(i,f(i)) for 1<=i<=m.
Is there any method to get y other than  the following code?
for i=1:m
y(i)=X(i,f(i));
end

Yes:
y = X((f-1)*m+i)

with i = 1:m. So:

y = X((f-1)*m + 1:m)

Example:
--> m = 7; n = 5;
--> // X = grand(m, n,"uin", 0, 9)
 X  = [
2.5.9.9.0.
2.8.0.3.1.
4.3.9.9.2.
5.5.4.6.9.
4.5.7.6.9.
1.0.6.6.8.
9.6.9.3.6.
 ]
-->i = 1:m
 i  =
1.2.3.4.5.6.7.

-->// f = grand(1, m,"uin", 1, n)

 f  = [1.4.4.3.4.5.2.  ]

-->X((f-1)*7+i)
 ans  =

2.
3.
9.
4.
6.
8.
6.

SG

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


Re: [Scilab-users] extracting elements of a matrix

2016-01-23 Thread fujimoto2005
Hi,Samuel

This is exactly what I want get.
Thanks a lot for your help.

Best regards



--
View this message in context: 
http://mailinglists.scilab.org/extracting-elements-of-a-matrix-tp4033321p4033326.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] mlist parameters to a function call

2016-01-23 Thread eddydde
Thanks,
works fine now.
Seen it in  one of the manuals, but didnt realize it applies to functions as
well!

Ed.



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