MATLAB Help - Quaternion Dynamic Simulation of a Low Earth Satellite

Поделиться
HTML-код
  • Опубликовано: 9 ноя 2024

Комментарии • 44

  • @masha_kasha5061
    @masha_kasha5061 3 года назад +3

    Just passed by to say thanks for the vids helped me out wrapping my brain around the whole Q-angle transforms

  • @henriquefchaves
    @henriquefchaves 3 года назад

    Best video ever. Do you think it is possible to do for a lunar orbit?
    Simulate a simple satellite orbit on the moon? Without perturbations, only kepler's law?
    Thanks man

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      Lunar orbit would be simple. Just change the radius of the planet you're orbiting and the mass and finally get rid of aerodynamics and the magnetic field.

  • @lucaamicucci7100
    @lucaamicucci7100 4 года назад +1

    Great Man!! Can you share the pdf file ??

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад +1

      github.com/cmontalvo251/MATLAB/blob/master/SpaceFlight_Mechanics_Montalvo/space_flight_mechanics.pdf

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад +1

      It's in here now github.com/cmontalvo251/LaTeX

  • @jonathangra-v6l
    @jonathangra-v6l Год назад

    Great video, I was trying to follow your code, but I have a problem with the H = I*pqr, its like it doesnt recognize pqr, very weird.
    Error using *
    Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows
    in the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.
    Error in Satelite (line 68)
    H = I * pqr;

    • @CarlosMontalvo251
      @CarlosMontalvo251  Год назад +1

      That's weird. the inertia matrix (I) is a 3x3 and pqr is the angular velocity vector at a size of 3x1 so the inner product dimensions line up just fine. You might need to run the code in debug mode to see what's going on.

    • @jonathangra-v6l
      @jonathangra-v6l Год назад

      @@CarlosMontalvo251 Will do, ty!

  • @ganesh2516822
    @ganesh2516822 3 года назад

    How did the graph of Bx,By,Bz vs tout change (when compared to last video) ? There is no change when populating BI matrix right ? It is same as that in the IGRF video right ? I was coding these by myself after watching the playlist. And at this stage the mag field graph is not the same as the one in this video but instead same as that of previous video. Please help

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      I think it is because in this video the satellite can rotate which means that the body frame is changing and thus the decomposition of the magnetic field vector in that frame.

    • @ganesh2516822
      @ganesh2516822 3 года назад

      @@CarlosMontalvo251 But BI is taken with respect to inertial frame so, the change in angular velocity is not supposed to affect BI. Isn't it ?

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      @@ganesh2516822 The inertial frame magnetic field vector will stay the same but if the angular velocity is non zero the attitude will change and thus the body frame components will change.

    • @ganesh2516822
      @ganesh2516822 3 года назад

      @@CarlosMontalvo251 Ok thank you for your reply sir

  • @SA-ys8eg
    @SA-ys8eg 3 года назад

    can you please show how you gave the earth image to the sphere in the matlab? Many thanks.

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад +1

      ruclips.net/video/djYowG_ITwk/видео.html

    • @SA-ys8eg
      @SA-ys8eg 3 года назад

      @@CarlosMontalvo251 Thank you so much Sir.

  • @aryaashutoshpathak4849
    @aryaashutoshpathak4849 2 года назад

    Hey, I'm trying to model a 3DOF (along angular axes) tetrahedral ADCS system for a CubeSat on Simulink using quaternions. To start I successfully simulated a 1DOF model but I'm struggling to generalize to 3D especially using quaternions, could you please suggest some resources regarding the same?

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      What do you mean? Is the software I explained above not suitable for what you're doing?

    • @aryaashutoshpathak4849
      @aryaashutoshpathak4849 2 года назад

      @@CarlosMontalvo251 No, I meant that your videos cover magnetorquer control, but I am using reaction wheels. It would be tremendously helpful if you could expand this series to include reaction wheels as well. Also, could you direct me to any similar resources where they have done what you did in this series but using reaction wheels as the actuators?

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад +1

      @@aryaashutoshpathak4849 Ahh. I have had numerous requests for Reaction Wheels. I am on holiday for the season so I will add this to my winter to-do list and will try and get to this asap.

    • @aryaashutoshpathak4849
      @aryaashutoshpathak4849 2 года назад

      @@CarlosMontalvo251 I cannot overstate how amazing that would be. Will be looking forward eagerly. Thanks a ton.

  • @aryaashutoshpathak4849
    @aryaashutoshpathak4849 2 года назад

    Why are the magnetic field plots different from the previous video? The only thing magnetic field depends on is x, y, z coordinates, the satellite spinning shouldn't change that in any way right? even if it does, in the first case at least (where all angular velocities were 0) shouldn't it match last vid's sim?
    Especially at 3:03 nothing new has been added that affects the mag field sim, but it's different from last time

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      Not quite. In this simulation the satellite is rotating. The magnetic field you are seeing is in the body frame of the satellite. Since the satellite is rotating the reference frame changes and thus the magnetic field in that reference frame also changes.

    • @aryaashutoshpathak4849
      @aryaashutoshpathak4849 2 года назад

      @@CarlosMontalvo251 Just to be clear, what exactly is "magnetic field" referring to here? I assumed that it means the strength of magnetic field at the point where the centre of mass of the satellite is located at that instant, is that correct or something else?

    • @aryaashutoshpathak4849
      @aryaashutoshpathak4849 2 года назад

      @@CarlosMontalvo251 also, in the NED frame is the origin situated at the center of the satellite? If so how does a simple rotation matrix suffice to convert between ECi and NED?
      and what is the difference between NED and body frame?

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      @@aryaashutoshpathak4849 The ECI frame is centered at the origina of a non rotating planet. The z axis points north and the x-axis points through the equator at the prime meridian. See Figure 2 of my book github.com/cmontalvo251/LaTeX/blob/master/Aerospace_Mechanics/aerospace_mechanics.pdf
      The NED frame is similar to a polar coordinate frame where the NED frame is fixed to the origin of the satellite but always points north (x-axis) and the D points towards the center of the planet. Again see Figure 2.
      The body frame is fixed to the satellite but rotates with the satellite which means the x-axis is always pointing towards a specific face on the satellite.
      Transformation matrices are dicussed in Section 5 of my book. Hope that helps

    • @aryaashutoshpathak4849
      @aryaashutoshpathak4849 2 года назад

      @@CarlosMontalvo251 understood now. Thank you!!

  • @andreasps579
    @andreasps579 3 года назад

    I need to write down quaternion dynamics simulation using matlab script for my research as a student. Can you provide the file Satellite.m so I can use it as a reference? Thank you.

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад +1

      Absolutely. It's all in here. github.com/cmontalvo251/MATLAB/tree/master/ADCS_Seminar_Series

    • @aryaashutoshpathak4849
      @aryaashutoshpathak4849 2 года назад

      @@CarlosMontalvo251 page not found :/

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      @@aryaashutoshpathak4849 Terribly sorry! I moved all my repos. github.com/cmontalvo251/aerospace/tree/main/adcs_seminar_series

  • @aphisarathammachak9536
    @aphisarathammachak9536 3 года назад

    If orbiting in 1 year, how to write code?

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      Just increase the time to 1 year *365 days * 24 hours * 3600 seconds

    • @aphisarathammachak9536
      @aphisarathammachak9536 3 года назад

      @@CarlosMontalvo251 And I have a short question where is increase time to orbit for year?

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      @@aphisarathammachak9536 It's lines 56-60
      period = 2*pi/sqrt(mu)*semi_major^(3/2);
      number_of_orbits = 12;
      tfinal = period*number_of_orbits;
      timestep = 1;
      tout = 0:timestep:tfinal;
      change tfinal to whatever you want in seconds

    • @aphisarathammachak9536
      @aphisarathammachak9536 3 года назад

      Thank you very much

  • @lucksilva16
    @lucksilva16 3 года назад

    Hey man, I'm learning a lot from your videos, thanks for sharing!! I was wondering if you could help me out, I'm trying to implement a CubeSat in single axis rotational dynamics from this paper: www.malcolmdshuster.com/Pub_1992a_C_Flatland_MDS.pdf
    The idea is to use reaction wheels as actuator and linearize the quaternions equations to use LQG control, but I'm having a hard time trying to solve this. Later on I want to build a physical system. Any advices or other materials I can look? It would be awesome if you could make a video about this as well if you don't have another about this topic.

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад +1

      Hey Lucas, sorry for the late reply. If you're wanting to do single axis dynamics you really just have a 1DOF second order problem where
      angular acceleration = total moments / inertia
      in this case total moments is going to equal the torque applied from the reaction wheels.
      I discuss a bit about reaction wheels in my SpaceFlight mechanics text
      github.com/cmontalvo251/LaTeX/blob/master/SpaceFlight_Mechanics_Montalvo/space_flight_mechanics.pdf
      And I think I have a quick 1DOF reaction wheel example here github.com/cmontalvo251/MATLAB/tree/master/CubeLAB/Reaction_Wheels
      Not sure if it works. It's been a while since I coded that in MATLAB

    • @lucksilva16
      @lucksilva16 3 года назад +1

      @@CarlosMontalvo251 Hello Carlos,
      I will take a look in the materials, I'm sure it will be a great help. Thanks for your reply.
      Regards

    • @hafizuddinmohdlowhim8426
      @hafizuddinmohdlowhim8426 3 года назад

      @@CarlosMontalvo251 what is the difference for 1DOF and what you have above?

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      @@hafizuddinmohdlowhim8426 1DOF is only 1 degree of freedom. This is a full 6DOF simulation of a satellite in orbit around the Earth