Undefined function or variable ' t ',how can I difine ' t ' correctly?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi!
I have defined a function which is:
function [ xs Fxs ] = RevNewton( F, grad, Hess, x, x0 )
where 'F' is the function of 'x'(can be a scalar or a vector),'x0' is the initial value of 'x','grad' and 'Hess' are the gradient vector and Hesse matrix respectively.
In this funtion,I used a varieble 't', which I haven't defined first, to transform the function F(x) to a function F(t) by using:
subs(F,{x},{x0+t.*p}),
where 'p' is a numerical vector.when using this function,I got an error:
??? Undefined function or variable 't'.
Error in ==> RevNewton at 10
fhandle=eval(['@(t)',vectorize(subs(F,{x},{x0+t.*p}))]);
0 Commenti
Risposta accettata
Star Strider
il 7 Giu 2014
If I understand ‘9 th row’ correctly, why not just state it as:
fhandle = @(t) vectorize(subs(F,{x},{x0+t.*p}));
2 Commenti
Più risposte (1)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!