plot euler angles for each time in matlab

If you have euler angles phi, theta, psi in radians for every time t, you can plot them against time using the following code:

main.m
        ```
        % input euler angles (in radians) and time
        % phi, theta, psi, and t should have the same size
        phi = [0.1, 0.2, 0.3];
        theta = [0.4, 0.5, 0.6];
        psi = [0.7, 0.8, 0.9];
        t = [1, 2, 3];

        % plot euler angles against time
        figure;
        plot(t, phi, 'r', t, theta, 'g', t, psi, 'b', 'LineWidth', 2);
        legend('\phi', '\theta', '\psi');
        xlabel('Time (s)');
        ylabel('Euler angles (rad)');
        title('Euler angles over time');
        grid on;
        ```

        This code will plot the euler angles `phi`, `theta`, `psi` against time `t` on a single graph with different colors for each angle. The `legend` function adds a legend to the plot and the `grid on` command adds a grid to the plot for better visualization. 

        Note that if you have euler angles in degrees, you need to convert them to radians before plotting.
922 chars
22 lines

related categories

gistlibby LogSnag