Search code examples
matlab3ddrawangle

how to draw a 3D angle in MATLAB


I have three angles who's values are 0.0 , 94.3750 , -0.5625. Starting from those 3 angles, how can I draw an 3D angle in MATLAB? Thanks in advance


Solution

  • You can try something like this:

    angles=abs(pi/2*rand(3,50)); %data
    figure
    for ii=1:size(angles,2)
    quiver3(0,0,0,cos(angles(1,ii)),cos(angles(2,ii)),cos(angles(3,ii))) %plot arrow
    view(30,30) %or Matlab will choose it arbitrarily
    axis([0 1 0 1 0 1]) %just for convenience
    pause(.2)
    end
    

    and if you want to save the figures in order:

    angles=abs(pi/2*rand(3,50));
    figure(1)
    for ii=1:size(angles,2)
    quiver3(0,0,0,cos(angles(1,ii)),cos(angles(2,ii)),cos(angles(3,ii)))
    view(30,30)
    axis([0 1 0 1 0 1])
    pause(.2)
    file_name= sprintf('%0.4d_%s_%s',ll);
    print('-f1',file_name,'-dpng')
    close(1)
    end