Why is the lsqnonlin function telling me I don't have enough input arguments?
조회 수: 3 (최근 30일)
이전 댓글 표시
I have the following main:
K0=[60.2,1.4,14.7,2.3e12];
[K, resnorm]= lsqnonlin(myfun, K0)
Given myfun:
function [ F ] = myfun( K )
d32e=[580.8045;643.367;698.974;522.9306;645.1539;672.7778;679.3988;422.6795;594.0621;715.9881;469.7453;574.4126;626.5233;758.8268];
F=PBE_FUNCTION(K)-d32e;
end
in Matlab 2015b.
When I attempt to run the main, I get:
Not enough input arguments.
Error in myfun (line 4) F=PBE_FUNCTION(K)-d32e;
Error in Main (line 4) [K, resnorm]= lsqnonlin(myfun, K0)
How can I make it run?
(Please note that the PBE_FUNCTION uses other functions in its script, dependent on K.)
댓글 수: 0
채택된 답변
Star Strider
2018년 1월 28일
One problem is that you need to use ‘@’ to create a function handle for ‘myfun’ in the lsqnonlin call:
[K, resnorm]= lsqnonlin(@myfun, K0)
I cannot run your code, so I do not know is the only problem.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Programming Utilities에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!