Getting Error ''Function 'subsindex' is not defined for values of class 'function_handle'."
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Please help, I am getting the above error when I am trying to input a function handle into another function. My code calling the function is as follows : a,b,c, and d are defined and have values. I do not understand what is wrong here. Thanks in advance.

2 Kommentare
Steven Lord
am 11 Dez. 2018
BTW your if statement, in the absence of any limitations on a and d, is not generally true.
Let a = -1, b = 1, c = 0, d = 0.5. d is greater than a, but the plot created by the code below clearly crosses y = 0 near x = 1 and x = -1.
>> f = @(x) -cos(x)+0.5;
>> fplot(f)
fzero confirms that f has a zero.
>> r = fzero(f, 0)
Let's plot the zero and check.
>> hold on
>> plot(r, f(r), 'ro')
>> yline(0);
Antworten (1)
Walter Roberson
am 11 Dez. 2018
you define Newton_Raphson as a variable , the result of ismember . But then you have
Newton_Raphson(y)
which asks to index the array using the function handle y as the index .
I have no idea what your intent is.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!