solve a coupled ODE of euler angels Rotation vector of a body










1















i'm trying to solve coupled ODEs by using matlab ode45 function:



enter image description here



Here is my function called 'Rot' to describe these ODE's for using matlab ode45.



function omega= Rot(t,y)
omega(2,1)=(0.03*sin(3*t)*((cos(Y(1)))^2)+0.002*t^3*sin(y(1)))...
/-((cos(Y(1)))^2)+((sin(Y(1)))^2);
omega(1,1)=((0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2)))*cos(y(2))+0.01*t^2+0.3*t;
omega(3,1)=(0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2));


but I'm getting "Not enough input arguments." error.










share|improve this question



















  • 1





    Yes. It is because of that.

    – Ander Biguri
    Nov 15 '18 at 11:38











  • omega(3,1) is a function of omega(2,1), which is itself a function of omega(3,1), so by combining the last two equations you should be able to get an expression of omega(3,1) which depends only t and y, and which you can then inject into the equation for omega(1,1).

    – am304
    Nov 15 '18 at 11:48











  • @am304 thanks for your command, I tried it but it didn't worked.

    – sajad soudani
    Nov 16 '18 at 8:50












  • Can you elaborate? What exactly didn't work? There's no reason mathematically why it shouldn't work.

    – am304
    Nov 16 '18 at 9:04











  • @am304 I checked the problem again, there was a mistake in the equations, in the 3rd one, there is an 'omega(2,1)' multiplied by sin(psi). i changed my code to decouple the equations as you told so, but now i'm receiving this error: Not enough input arguments.

    – sajad soudani
    Nov 16 '18 at 12:10
















1















i'm trying to solve coupled ODEs by using matlab ode45 function:



enter image description here



Here is my function called 'Rot' to describe these ODE's for using matlab ode45.



function omega= Rot(t,y)
omega(2,1)=(0.03*sin(3*t)*((cos(Y(1)))^2)+0.002*t^3*sin(y(1)))...
/-((cos(Y(1)))^2)+((sin(Y(1)))^2);
omega(1,1)=((0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2)))*cos(y(2))+0.01*t^2+0.3*t;
omega(3,1)=(0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2));


but I'm getting "Not enough input arguments." error.










share|improve this question



















  • 1





    Yes. It is because of that.

    – Ander Biguri
    Nov 15 '18 at 11:38











  • omega(3,1) is a function of omega(2,1), which is itself a function of omega(3,1), so by combining the last two equations you should be able to get an expression of omega(3,1) which depends only t and y, and which you can then inject into the equation for omega(1,1).

    – am304
    Nov 15 '18 at 11:48











  • @am304 thanks for your command, I tried it but it didn't worked.

    – sajad soudani
    Nov 16 '18 at 8:50












  • Can you elaborate? What exactly didn't work? There's no reason mathematically why it shouldn't work.

    – am304
    Nov 16 '18 at 9:04











  • @am304 I checked the problem again, there was a mistake in the equations, in the 3rd one, there is an 'omega(2,1)' multiplied by sin(psi). i changed my code to decouple the equations as you told so, but now i'm receiving this error: Not enough input arguments.

    – sajad soudani
    Nov 16 '18 at 12:10














1












1








1








i'm trying to solve coupled ODEs by using matlab ode45 function:



enter image description here



Here is my function called 'Rot' to describe these ODE's for using matlab ode45.



function omega= Rot(t,y)
omega(2,1)=(0.03*sin(3*t)*((cos(Y(1)))^2)+0.002*t^3*sin(y(1)))...
/-((cos(Y(1)))^2)+((sin(Y(1)))^2);
omega(1,1)=((0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2)))*cos(y(2))+0.01*t^2+0.3*t;
omega(3,1)=(0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2));


but I'm getting "Not enough input arguments." error.










share|improve this question
















i'm trying to solve coupled ODEs by using matlab ode45 function:



enter image description here



Here is my function called 'Rot' to describe these ODE's for using matlab ode45.



function omega= Rot(t,y)
omega(2,1)=(0.03*sin(3*t)*((cos(Y(1)))^2)+0.002*t^3*sin(y(1)))...
/-((cos(Y(1)))^2)+((sin(Y(1)))^2);
omega(1,1)=((0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2)))*cos(y(2))+0.01*t^2+0.3*t;
omega(3,1)=(0.002*t^2-omega(2,1)*sin(y(1)))...
/-cos(y(3))*sin(y(2));


but I'm getting "Not enough input arguments." error.







matlab robotics






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 16:47









am304

12.2k21431




12.2k21431










asked Nov 15 '18 at 8:15









sajad soudanisajad soudani

184




184







  • 1





    Yes. It is because of that.

    – Ander Biguri
    Nov 15 '18 at 11:38











  • omega(3,1) is a function of omega(2,1), which is itself a function of omega(3,1), so by combining the last two equations you should be able to get an expression of omega(3,1) which depends only t and y, and which you can then inject into the equation for omega(1,1).

    – am304
    Nov 15 '18 at 11:48











  • @am304 thanks for your command, I tried it but it didn't worked.

    – sajad soudani
    Nov 16 '18 at 8:50












  • Can you elaborate? What exactly didn't work? There's no reason mathematically why it shouldn't work.

    – am304
    Nov 16 '18 at 9:04











  • @am304 I checked the problem again, there was a mistake in the equations, in the 3rd one, there is an 'omega(2,1)' multiplied by sin(psi). i changed my code to decouple the equations as you told so, but now i'm receiving this error: Not enough input arguments.

    – sajad soudani
    Nov 16 '18 at 12:10













  • 1





    Yes. It is because of that.

    – Ander Biguri
    Nov 15 '18 at 11:38











  • omega(3,1) is a function of omega(2,1), which is itself a function of omega(3,1), so by combining the last two equations you should be able to get an expression of omega(3,1) which depends only t and y, and which you can then inject into the equation for omega(1,1).

    – am304
    Nov 15 '18 at 11:48











  • @am304 thanks for your command, I tried it but it didn't worked.

    – sajad soudani
    Nov 16 '18 at 8:50












  • Can you elaborate? What exactly didn't work? There's no reason mathematically why it shouldn't work.

    – am304
    Nov 16 '18 at 9:04











  • @am304 I checked the problem again, there was a mistake in the equations, in the 3rd one, there is an 'omega(2,1)' multiplied by sin(psi). i changed my code to decouple the equations as you told so, but now i'm receiving this error: Not enough input arguments.

    – sajad soudani
    Nov 16 '18 at 12:10








1




1





Yes. It is because of that.

– Ander Biguri
Nov 15 '18 at 11:38





Yes. It is because of that.

– Ander Biguri
Nov 15 '18 at 11:38













omega(3,1) is a function of omega(2,1), which is itself a function of omega(3,1), so by combining the last two equations you should be able to get an expression of omega(3,1) which depends only t and y, and which you can then inject into the equation for omega(1,1).

– am304
Nov 15 '18 at 11:48





omega(3,1) is a function of omega(2,1), which is itself a function of omega(3,1), so by combining the last two equations you should be able to get an expression of omega(3,1) which depends only t and y, and which you can then inject into the equation for omega(1,1).

– am304
Nov 15 '18 at 11:48













@am304 thanks for your command, I tried it but it didn't worked.

– sajad soudani
Nov 16 '18 at 8:50






@am304 thanks for your command, I tried it but it didn't worked.

– sajad soudani
Nov 16 '18 at 8:50














Can you elaborate? What exactly didn't work? There's no reason mathematically why it shouldn't work.

– am304
Nov 16 '18 at 9:04





Can you elaborate? What exactly didn't work? There's no reason mathematically why it shouldn't work.

– am304
Nov 16 '18 at 9:04













@am304 I checked the problem again, there was a mistake in the equations, in the 3rd one, there is an 'omega(2,1)' multiplied by sin(psi). i changed my code to decouple the equations as you told so, but now i'm receiving this error: Not enough input arguments.

– sajad soudani
Nov 16 '18 at 12:10






@am304 I checked the problem again, there was a mistake in the equations, in the 3rd one, there is an 'omega(2,1)' multiplied by sin(psi). i changed my code to decouple the equations as you told so, but now i'm receiving this error: Not enough input arguments.

– sajad soudani
Nov 16 '18 at 12:10













1 Answer
1






active

oldest

votes


















0














OK, so by expressing theta_dot as a function of the other variables in equation (3) and injecting the result in equation (2), I get (pseudo-code):



phi_dot = (0.03*sin(psi)*sin(3*t) - 0.002*t^2 * cos(psi)) / (sin(theta)*(cos(psi))^2 + sin(theta) * sin(psi) * sin(phi))



So makes that the first equation of your ODE file as it only depends on time and the state vector.



Then your second equation in the ODE file is:



psi_dot = -phi_dot * cos(theta) + 0.01*t^2 + 0.3*t



which is OK because you've calcuated phi_dot in the previous equation.



And finally the last equation in your ODE file:



theta_dot = (-0.03*sin(3*t) + phi_dot * sin(theta) * sin(phi)) / cos(psi);



which is also OK because you have calculated phi_dot in your first equation.



You can then pass this to the ODE solver and it should work. (do check my maths though)






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314997%2fsolve-a-coupled-ode-of-euler-angels-rotation-vector-of-a-body%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    OK, so by expressing theta_dot as a function of the other variables in equation (3) and injecting the result in equation (2), I get (pseudo-code):



    phi_dot = (0.03*sin(psi)*sin(3*t) - 0.002*t^2 * cos(psi)) / (sin(theta)*(cos(psi))^2 + sin(theta) * sin(psi) * sin(phi))



    So makes that the first equation of your ODE file as it only depends on time and the state vector.



    Then your second equation in the ODE file is:



    psi_dot = -phi_dot * cos(theta) + 0.01*t^2 + 0.3*t



    which is OK because you've calcuated phi_dot in the previous equation.



    And finally the last equation in your ODE file:



    theta_dot = (-0.03*sin(3*t) + phi_dot * sin(theta) * sin(phi)) / cos(psi);



    which is also OK because you have calculated phi_dot in your first equation.



    You can then pass this to the ODE solver and it should work. (do check my maths though)






    share|improve this answer



























      0














      OK, so by expressing theta_dot as a function of the other variables in equation (3) and injecting the result in equation (2), I get (pseudo-code):



      phi_dot = (0.03*sin(psi)*sin(3*t) - 0.002*t^2 * cos(psi)) / (sin(theta)*(cos(psi))^2 + sin(theta) * sin(psi) * sin(phi))



      So makes that the first equation of your ODE file as it only depends on time and the state vector.



      Then your second equation in the ODE file is:



      psi_dot = -phi_dot * cos(theta) + 0.01*t^2 + 0.3*t



      which is OK because you've calcuated phi_dot in the previous equation.



      And finally the last equation in your ODE file:



      theta_dot = (-0.03*sin(3*t) + phi_dot * sin(theta) * sin(phi)) / cos(psi);



      which is also OK because you have calculated phi_dot in your first equation.



      You can then pass this to the ODE solver and it should work. (do check my maths though)






      share|improve this answer

























        0












        0








        0







        OK, so by expressing theta_dot as a function of the other variables in equation (3) and injecting the result in equation (2), I get (pseudo-code):



        phi_dot = (0.03*sin(psi)*sin(3*t) - 0.002*t^2 * cos(psi)) / (sin(theta)*(cos(psi))^2 + sin(theta) * sin(psi) * sin(phi))



        So makes that the first equation of your ODE file as it only depends on time and the state vector.



        Then your second equation in the ODE file is:



        psi_dot = -phi_dot * cos(theta) + 0.01*t^2 + 0.3*t



        which is OK because you've calcuated phi_dot in the previous equation.



        And finally the last equation in your ODE file:



        theta_dot = (-0.03*sin(3*t) + phi_dot * sin(theta) * sin(phi)) / cos(psi);



        which is also OK because you have calculated phi_dot in your first equation.



        You can then pass this to the ODE solver and it should work. (do check my maths though)






        share|improve this answer













        OK, so by expressing theta_dot as a function of the other variables in equation (3) and injecting the result in equation (2), I get (pseudo-code):



        phi_dot = (0.03*sin(psi)*sin(3*t) - 0.002*t^2 * cos(psi)) / (sin(theta)*(cos(psi))^2 + sin(theta) * sin(psi) * sin(phi))



        So makes that the first equation of your ODE file as it only depends on time and the state vector.



        Then your second equation in the ODE file is:



        psi_dot = -phi_dot * cos(theta) + 0.01*t^2 + 0.3*t



        which is OK because you've calcuated phi_dot in the previous equation.



        And finally the last equation in your ODE file:



        theta_dot = (-0.03*sin(3*t) + phi_dot * sin(theta) * sin(phi)) / cos(psi);



        which is also OK because you have calculated phi_dot in your first equation.



        You can then pass this to the ODE solver and it should work. (do check my maths though)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 16:59









        am304am304

        12.2k21431




        12.2k21431





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314997%2fsolve-a-coupled-ode-of-euler-angels-rotation-vector-of-a-body%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

            Museum of Modern and Contemporary Art of Trento and Rovereto