Array indices must be positive integers or logical values
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
When I try to save the "t" and "v" values into the x(i) and y(i) vectors, I keep getting th same mistake. "Array indices must be positive integers or logical values."
Im trying to save tha value of each itiretation so I can plot all of them, anyone got another solution for this?
clc;
clear;
clc;
h=.12
rtanque=.1
rsalida=.005
g=9.806;
for i = (h:-.01:.00001)
Vol=(pi.*rtanque.^2).*i;
v=(2.*g.*i).^(1/2)
Q=(2.*(pi.*rsalida.^2)).*v;
t=Vol/Q
x(i)=t
y(i)=v
end
plot(x,y);
xlabel('Tiempo en [s]')
ylabel('Velocidad en [m/s]')
title('Gráfica Velocidad vs Tiempo')
grid on;
hold on;
0 Commenti
Risposte (1)
VBBV
il 3 Dic 2020
clc;
clear;
clc;
h= linspace(0.00001,0.12,12)
rtanque=.1
rsalida=.005
g=9.806;
for i = 1:length(h)
Vol=(pi.*rtanque.^2).*i;
v=(2.*g.*i).^(1/2)
Q=(2.*(pi.*rsalida.^2)).*v;
t=Vol/Q
x(i)=t
y(i)=v
end
plot(x,y);
xlabel('Tiempo en [s]')
ylabel('Velocidad en [m/s]')
title('Gráfica Velocidad vs Tiempo')
grid on;
hold on;
Vedere anche
Categorie
Scopri di più su Digital Filter Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!