# Problem with Argument and fsolve

조회 수: 2(최근 30일)
satendra kumar 2013년 4월 29일
Hi everyone, I am trying to solve:
S= (50625*(arg(x*i + y - 1393 - 746*i) - 3560289735917593/36028797018963968)^2)/pi^2 + ((x + (y - 987)^2 - 24025)^(1/2)/2 - 8643/20)^2 + (3240000*(arg(x*i + y - 259 - 1571*i) + 8955599335723659/288230376151711744)^2)/(169*pi^2) + (90000*(arg(x*i + y - 375 - 629*i) - 3959779706285659/144115188075855872)^2)/pi^2
end
with fsolve. But i am getting following error message:
'Undefined function 'arg' for input arguments of type 'double'.
Error in myfun (line 2)
F = [((x(1) + (x(2) - 987)^2 - 24025)^(1/2)/2 - 8643/20)/(2*(x(1) + (x(2) - 987)^2 - 24025)^(1/2)) -
(6480000*((17*pi)/60 + arg(x(1)*i + x(2) - 259 - 1571*i))*(imag(x(1)) - real(x(2)) + 259))/(169*pi
Error in fsolve (line 241)
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
'
##### 댓글 수: 5표시 이전 댓글 수: 4숨기기 이전 댓글 수: 4
Walter Roberson 2013년 4월 29일
? Your current function has no reference to arg(). Are you possibly using matlabFunction() to generate the function in some code you have not shown here? The myfun() you have shown here has no relationship to finding S or Sx or Sy.

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

### 답변(1개)

Shashank Prasanna 2013년 4월 29일
Satendra, arg is not a function in MATLAB but you the function 'angle' computes the argument of the complex number which I believe you are trying to find. In your 'S' replace 'arg' with 'angle'
##### 댓글 수: 1표시 없음숨기기 없음
satendra kumar 2013년 4월 29일
편집: satendra kumar 2013년 4월 29일
Thanks Shashank, But when i did that i got following error message:
Undefined function 'atan2' for input arguments of type 'sym'.
Error in angle (line 14)
p = atan2(imag(h), real(h));

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

### 범주

Find more on Nonlinear Optimization in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!