function and matrix form

조회 수: 4 (최근 30일)
sarngon
sarngon 2012년 1월 26일
codes function kdot=train(t,x) alfa=0.3; beta=0.13; gama=0.16; Ua=1; Ub=2; kdot=[k(2);(2/pi)*(atan((x-4)/0.05)+atan((x-2)/0.05))- (alfa+beta*abs(k(2))+gama*(k(2)^2))+Ua-Ub];
end
and the error line
??? Undefined function or method 'k' for input arguments of type 'double'.
Error in ==> train at 7 kdot=[k(2);(2/pi)*(atan((x-4)/0.05)+atan((x-2)/0.05))-(alfa+beta*abs(k(2))+gama*(k(2)^2))+Ua-Ub];
thanks..
  댓글 수: 1
Jan
Jan 2012년 1월 26일
Please take the time to format the code properly. Currently it is not readable. Look at the "Markup help" link on this page.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 26일
You have not defined any function or variable named "k", so the k(2) in your function has no meaning.

추가 답변 (1개)

Jan
Jan 2012년 1월 26일
The error message is clear: You try to access k(2), but k is neither a variable nor a function in the path.
What is k?

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by