I'm trying to populate an array with values from a function that I am running. In this function I am changing a variable z2 in increments of 0.01 from 0 to 0.99. At the same time I want to populate an array with those values. I've tried a while loop and a for loop. How to write this with only a for loop?
my code:
Ys = y(2000);
Mp = ((max(y)-Ys)/Ys)*100;
[max, i] = max(y);
tp = t(i);
z = sqrt(((log(Mp))^2)/((pi*pi)+(log(Mp))^2));
%Given Equations
wd = pi/tp;
wn = wd/(sqrt(1-(z*z)));
ts = 4.6/(z*wn);
tr = 1.8/wn;
%for loop for z from 0 to 0.99
for i = 1:100;
for z2 = 0:0.01:0.99
%tr*wn = Fa
Fa(i) = 2.917*z2^2 - 0.4167*z2 + 1;
i = i + 1;
if i >= 100;
break;
end
end
end
find_zeta = interp1(Fa, 1.8);
disp(Fa);
disp(find_zeta);
error I am experiencing: I am getting only 1s in my array.