fzero for a loop of functions
Show older comments
What I'm trying to do is frustratingly simple. I'm trying to use the fzero function to find a root for the function below, at each value of "n" from 1 to 25. I'm currently running fzero for the function below, then manually changing the value of "n" to 2, saving the .m file, fzero'ing again, and so forth. I'm looking for a cleaner way to do this.
*As a tidbit of extra information that may be relevant, fzero only works when given an input of at least 46 in the form "fzero(@TerminalV,46). anything below that returns a "NaN".
function fx = TerminalV(v)
A = pi()*(0.15)^2/4;
T = [213.15:5:333.15];
for n=1;
fx = 9.8*0.5*2./(Density(T(n)).*A)-(v.^2).*(24./((Density(T(n)).*v.*0.15)./viscosity(T(n)))...;
+6./(1+(Density(T(n)).*v.*0.15./viscosity(T(n))).^0.5)+0.04);
end
end
4 Comments
madhan ravi
on 6 Mar 2019
Density, Viscosity, v?
Filip Jackowski
on 6 Mar 2019
Edited: Filip Jackowski
on 6 Mar 2019
madhan ravi
on 6 Mar 2019
T?
Filip Jackowski
on 6 Mar 2019
Accepted Answer
More Answers (0)
Categories
Find more on Problem-Based Optimization Setup 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!