I hope this is the right area. I'm trying to get this code to work in MatLab.
function y=test(x)
y=-x+(B/(B-1))*(r-a)*p+(B/(B-1))*(r-a)*(b((1-(b/x)^(B-1))/r- a)+p* ((b/x)^B))/(1-(b/x)^B);
end
I then jump to the command value and type this:
B=3.0515;
b=1.18632*10^5;
a=.017;
r=.054;
p=5931617;
I then try to find the zeros of the first equation by typing this and I get errors:
solution=fzero(@test,5000000)
I'm getting the following error:
Error: File: test.m Line: 5 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "test".)
New error
Error using fzero (line 289) FZERO cannot continue because user supplied function_handle ==> @(x) (test(x,B,b,a,r,p)) failed with the error below.
Subscript indices must either be real positive integers or logicals.
B,b,aetc in the commend line, they will not have scope in your functiontest. So as far astestis concerned they are essentially undefined. - Dan