I am trying to calculate the terminal velocity of a bicyclist, and I cannot for the life of me figure out how to plot it. This is the code I've got so far:
%% Sets the parameters
P = 400; % Watts
A = 0.4; % Squared meters
m = 65; % Kilograms
rho = 1.3; % Kilograms per cubic meter
C = 0.5; % Air resistance constant
%% Sets the initial conditons
v1 = 1; % (m/s)
v = v1; % (m/s)
tau = 0.1; % (s)
%% Calculates the terminal velocity
for i = 1:100
t = (i - 1)*tau; v = v + ((P/(m*v)))*t - ((C*rho*A*v^2)/(2*m))*t;
end
plot(t,v);
Now what I think is happening is the loop calculates the time value, saves it, uses it for the velocity, saves that, and repeats. But when I go to generate the plot, I just get a blank graph. Any insight into how to get the nice shape the graph should have would be appreciated.
Best Answer