The error 'Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.', is coming up for line 84. Can anyone see my issue? this is my line 84:
c(i+1) = c(i) - parError(c(i), m, g)/pardError(c(i), m, g))
i am writting an NR soultion, this is my NR soultion;
init_guess = 8;
c(1) = init_guess;
lim = 0.01;
rel_error = 1;
i = 1;
eVec = [1:20];
while ((c(i)-c(i+1))>0.01 & (i < 20))
c(i+1) = c(i) - parError(c(i), m, g)/pardError(c(i), m, g))
rel_error = abs((c(i+1)-c(i))/(c(i)))
numbers[c(i),parError(c(i), m, g)]
numbers2[pardError(c(i), m, g), c(i+1)-c(i)];
eVec(i)=rel_error;
i = i+1;
str1=['At c = ', num2str(numbers2(1)), ', the error = ', num2str(numbers2(2))];
str2=['The gradient is ', num2str(numbers2(1)), ', the step is ', num2str(numbers2(2))];
disp(str);
disp(str2);
end
for the parError and pardError, these are the functions;
function error = parError( c, m, g)
error = ( (40*c) / (m*g) )-( 1-exp( (-10*c)/m ) );
end
function dError = pardError( c, m, g)
dError=(40/(m*g)) -(( 10*exp( (-10*c)/m ) )/m)
end