Why won't Matlab plot anything?
Afficher commentaires plus anciens
clear all
close all
% given values %
m = 80; %kg the mass of the sprinter%
F_x= 400; %N%
L = 100; %m the lenght of the race%
p = 1.293; %kg/m^3 the density of the air%
A = 0.45; %m^2 the cross-sectional area%
Cd = 1.2; %the drag force%
w = 0; %air velocity
time = 10;
dt = 0.1;
n = round(time/dt);
D = zeros(n,1);
a = zeros(n,1);
v = zeros(n,1);
x = zeros(n,1);
t = zeros(n,1);
a(1)= F_x/m;
v(1)=0;
x(1)=0;
D(1)=0;
t(1)=0;
for i = 1:n-1
a(i+1) = (F_x - D(i))/m;
v(i+1) = v(i) + a(i)*dt;
D(i+1) = 0.5*p*Cd*A*(v(i)-w)^2;
x(i+1) = x(i)+ v(i)*dt + 0.5*a(i)*dt^2;
t(i+1) = t(i) + dt;
if x(i+1)>=100
return
end
end
f1 = plot(t,x);
f2 = plot(t,v);
f3 = plot(t,a);
This is my code.
plot dose not show up. I hope to get help fixing it
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Polar Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


