ode 45 and for loop
Show older comments
Hi,
I would like to use a for loop for a constant value i in my diff.eq. but I don't know how to implement it. Also I would like to have the matrices X and T for al the values of i.
for i : 0.1:0.1:10
[T,X] = ode45(@fx, [0 4], [0 0]) %Can I implement i here and give the matrices X and T an index?
end
function dx = fx(t,x) % Can I give i as an input here.
rho = 1.225;
C_w = 0.3;
A = 0.005;
m = 0.314;
C_r = 0.035;
R_T = 0.7;
n_0 = 378.33;
i = 1;
T_stall = 0.1868;
r = 0.030;
dx = zeros (2,1);
dx(1) = x(2);
dx(2) = (-T_stall * R_T * i^2 * ((1000 * x(2)/ pi ) - n_0/i)/(n_0 * r) - m * 9.81 * C_r - 0.5 * rho * A * C_w * x(2)^2)/m;
% the diff. eq. with i
end
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!