its been displaying " Index exceeds the number of array elements (1). Error in sym/subsref (line 890) R_tilde = builtin('subsref',L_tilde,Idx);" can someone help me with this
Show older comments
i=1;
p0=[0.5 0 0 50];
N=10;
error=0.00001;
syms 'x'
%To simplify the equation,we need to make the coefficients
z1=0.949;
z2=3.439;
z3=18.72;
z4=37.51;
z5=1.169;
%equation for the 4 components
f(x)= [z1*x(1)*(1-x(1)/z2);z3*x(1)*x(4)/(z4+x(4))-1.0617*x(2); z5*x(2);-z3*x(1)*x(4)/(z4+x(4))];
df= diff(f)
while i<= N
p=p0-(f(p0)/df(p0));
if (abs(p-p0))/(abs(p))< error
fprintf('solution is %\n',double(p))
return
end
i=i+1;
p0=p;
end
fprintf('solution did not converge within %d iterationat require precision',N,error)
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!