Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
function plotTrajectory(initialSpeed, initialAngle, height)
	    [x, y] = trajectory(initialSpeed, initialAngle, height);
	    plot (x, y);
end     grid on;
    xlabel('x');
    ylabel('y');
    title('plotTrajectory');
end 

g)

Code Block
 functionfunction plotTrajectoryLength (initialSpeed, start, step, stop, height)
    initialAngles = start:step:stop;
    n = length(initialAngles);
    lengths = zeros(n,1);
    for i = 1:n
        [x, y] = trajectory(initialSpeed, initialAngles(i), height);
        j = length (x);
        lengths (i) = x(j);
    end
    plot (initialAngles ,lengths);
    xlabel('Angle');
    ylabel('y');
    grid on;
    title('plotTrajectoryLength');
end

Det kan virke som om pi/4 (45 grader) gir lengst støt. Dette virker intuitivt korrekt.

...