Le 13/12/2012 07:56, Lester Anderson a écrit :
Hi Serge

A quick question. In the context of the equation, what is the purpose of the ones(t) part? The help states that this creates a matrix composed of ones.

(B./(m1.^3*%pi).*sin(m1*%pi/B)) is a column vector, the multiplication by 
ones(t) which is a row vector  is a way to create a matrix with identical 
columns
. Ina similar mannerm1.^2*t
 creates a matrix multiplying the column vectorm1.^2  by the row vector t

g=c*sum((B./(m1.^3*%pi).*sin(m1*%pi/B))*ones(t).*exp(-(m1.^2*t/tau)),1);
Probabaly a very simple answer.

Cheers

Lester

On 12 December 2012 22:46, Lester Anderson <[email protected] <mailto:[email protected]>> wrote:

    Many thanks Serge :) That worked great!
    Helps to see how the syntax should work.

    Cheers

    Lester


    On 12 December 2012 22:29, Serge Steer <[email protected]
    <mailto:[email protected]>> wrote:

        I think the following code fullfil your wish...


        n  =  0:1:20  ;// series in the expansion
        B  =  1.5;  //beta factor
        Tm  =  1300*274.15;  //base-lithosphere temperature [C]
        tau  =  62.8;  //lithosphere cooling thermal decay constant [Ma]
        a  =  125000;  //equilibrium lithospheric thickness [m]
        alpha  =  3.28e-5  ;//thermal expansion coefficient K^-1
        // Tm needs to be converted to Kelvin - multiply by 274.15
        rho  =  3300;
        t  =  0:5:150;  //lithosphere age [Ma]
        G  =  6.67e-11;

        // LTGA with increasing age of oceanic lithosphere

        c=8*G*alpha*rho*a*Tm/%pi;
        m=(0:20)';m1=2*m+1;
        g=c*sum((B./(m1.^3*%pi).*sin(m1*%pi/B))*ones(t).*exp(-(m1.^2*t/tau)),1);
        clf;plot(t,g)


        Serge Steer
        ------------------------------------------------------------------------

            *De: *"Lester Anderson" <[email protected]
            <mailto:[email protected]>>
            *À: *"International users mailing list for Scilab."
            <[email protected] <mailto:[email protected]>>
            *Envoyé: *Mardi 11 Décembre 2012 08:16:01
            *Objet: *[Scilab-users] Summation query in Scilab


            Hello,

            I have an equation structured like in the attached,
            however I am unsure of the correct syntax to compute in
            Scilab.

            One can calculate the first term of the expansion but
            obvioulsy it needs to go to a large number (approximating
            infinity eg 20).
            I am sure this is something very straightforward!

            Any ideas welcome.

            Thanks for the help

            Lester

            att: image of equation, test code

            _______________________________________________
            users mailing list
            [email protected] <mailto:[email protected]>
            http://lists.scilab.org/mailman/listinfo/users



        _______________________________________________
        users mailing list
        [email protected] <mailto:[email protected]>
        http://lists.scilab.org/mailman/listinfo/users





_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to