I am writing this simple matlab code and it is not running at all
function F = position4(x)
F(1) = 40*cos(50* (pi/180)) + 100* cos(x(2)* (pi/180)) - x(1) ;
F(2) = 40*sin(50* (pi/180)) + 100 * sin(x(2)* (pi/180));
guess = [120, 17];
fsolve(@position4,guess )
end

댓글 수: 1

Jan
Jan 2018년 2월 20일
Please post the inputs, how you call it and a copy of the complete error message. Otherwise trying to help you require too much guessing, what the problem is. It is strange, that you call fsolve from within the function you provide as handle.

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

 채택된 답변

Torsten
Torsten 2018년 2월 20일

0 개 추천

function main
guess = [120, 17];
xsol = fsolve(@position4,guess )
function F = position4(x)
F(1) = 40*cos(50* (pi/180)) + 100* cos(x(2)* (pi/180)) - x(1) ;
F(2) = 40*sin(50* (pi/180)) + 100 * sin(x(2)* (pi/180));
... and run this as a function file named "main.m"
Best wishes
Torsten.

댓글 수: 1

ehab maher
ehab maher 2018년 2월 22일
Thank youu so much, it actually worked but can you tell me how?!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2018년 2월 20일

댓글:

2018년 2월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by