필터 지우기
필터 지우기

Error using inline. Input must be a string.

조회 수: 6 (최근 30일)
Roberto Antonino Ruggeri
Roberto Antonino Ruggeri 2016년 2월 11일
편집: Roberto Antonino Ruggeri 2016년 2월 13일
Hi Everyone. I'm studying the steepest descend method and I have tried to compile this method for a function. The problem is that when I compile, the command window shows "Error using inline (line 51)Input must be a string." and I don't know what to do.
  댓글 수: 1
Stephen23
Stephen23 2016년 2월 11일
편집: Stephen23 2016년 2월 11일
Inline functions are basically obsolete... you should be using function handles!

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 11일
syms X
fprime = matlabFunction( diff(exp(-X)+X.^4', X) );
If you do not have the symbolic toolbox then diff() is entirely the wrong function to use, as diff() on a non-symbolic object X is X(2:end,:) - X(1:end-1,:) -- that is, numeric difference between adjacent elements.
If you do not have the symbolic toolbox then
fprime = @(X) -exp(-X) + 4.*X.^3;
would be the formula.
  댓글 수: 1
Roberto Antonino Ruggeri
Roberto Antonino Ruggeri 2016년 2월 11일
Oh thank you so much Walter!!! Now it works!! Thank you!!

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

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by