Undefined function or variable ' t ',how can I difine ' t ' correctly?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2014년 6월 7일
If I understand ‘9 th row’ correctly, why not just state it as:
fhandle = @(t) vectorize(subs(F,{x},{x0+t.*p}));
댓글 수: 2
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!