function [r] = range_calculator(a,v)%UNTITLED Summary of this function goes here
% Takes angle vector and an 8 value velocity vector as inputs and calculates the range,
%and plots a graph of range vector versus angle vector for each velocity.
g=9.9;a=0:0.05:pi/2;v=linspace(50,100,8);for k=1:length(v) r(k)=(v(k).^2/g).*sin(2.*a(k));endplot(a(k),r(k),'--r*')grid ontitle('The initial velocity is v(k)')xticks(-0.4:0.2:1.8)yticks(0:50:800)xlabel('Cannon Angle')ylabel('Range,Meters')end
MATLAB: Hey guys please i need help with this. i am trying to have this function plot a graph of (a,r). The graph should be a curve but it gives me just a point. I don’t know what i did wrong!
graph
Related Question
- How to plot x(t) = 0.9^k*cos(pi*k/5)*u(k) with simulink
- Is the code only outputting one value instead of a vector
- My code is just about there, but there is something not right…I can’t figure it out. Help?!
- Error with a function
- How to create a vector
- Cannot plot iterations.
- How to plot these two graphs with the array/set of inputs
- Warning: Cannot solve symbolically
Best Answer