Storing a 1x500-double that's imbedded in a loop
Show older comments
Hello all,
My question lies in how to output or store each value of "v" that is inside my for loop.
I know I can leave it unsupressed and it will pop out 10 different 1x500 doubles in the command window, but what I really want is for the loop to output "v" everytime it iterates, essentially giving me something like v1, v2, v3... v10 so I can look at each 1x500 double individually.
If anyone can offer any help, guidance, or advice I would truly appreciate it. This doesn't seem like something too hard to do but I am quite the noob when it comes to using MATLAB, so I apologize in advance if this is something blatanly obvious that I just don't know how to do.
clc
clear all
t = linspace(0,30,500);
g = 9.81;
m = [0.0008877 0.0017754 0.0026631 0.0035508 0.0044385 0.0053262...
0.0062139 0.0071016 0.0079893 0.008877];
rho = 1.225;
A = 0.19113;
Cd = 0.819346574;
k = (1/2).*Cd.*rho.*A;
v = zeros(1,10);
% Vt = zeros();
% Y = zeros();
% x = zeros();
for i=1:10
Vt = sqrt((m(1,i).*g)./k);
Y = (g.*t)./Vt;
v = Vt.*tanh(Y.*(pi/180));
plot(t,v)
hold on
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!