MATLAB Answers

Reynolds number, FalsePosition getting multiple errors with no output

31 views (last 30 days)
Anastasia Zistatsis
Anastasia Zistatsis on 23 Jan 2021
Commented: VBBV on 23 Jan 2021
I am to create a function that uses FalsePosition (function shown below) to solve for f in the given equation. I think I'm missing some connections between my script and the function I'm trying to call.
Here is FalsePosition
This is my code:
function [root, fx, ea, iter] = falsepositionnew(y)
xl = 2500;
xu = 1000000;
es = 0.0000001;
maxit = 200;
Re = 10000:200000;
y = @(f, Re) 1/sqrt(f) - 4*log(Re*sqrt(f))+0.4; %equation given
for = i:numel(Re)
f(i) = falseposition(y,xl,xu,es,maxit);
end

  0 Comments

Sign in to comment.

Answers (1)

VBBV
VBBV on 23 Jan 2021
%if true
for i = 1:numel(Re) % change this line

  4 Comments

Show 1 older comment
VBBV
VBBV on 23 Jan 2021
Notice the change in case for the function name in your code in for loop. And the name on the code snaphot you showed.
VBBV
VBBV on 23 Jan 2021
The function also outputs more variables than what its shown in for loop.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by