필터 지우기
필터 지우기

error with output dimensions

조회 수: 1 (최근 30일)
Hana
Hana 2012년 7월 6일
i'm stuck with this error:
In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in myfun (line 7)
y(1)=(u.^2) + (y.^2)-d;
Error in fsolve (line 241)
fuser = feval(funfcn{3},x,varargin{:});
Error in modfsolve (line 26)
x= fsolve(@myfun,x0,options,uc,d,spacing_amplitude,spacing_width);
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE
cannot continue.*
i don't understand, why this won't get a skalar?since the elements are all scalar.
best regards

채택된 답변

Jan
Jan 2012년 7월 6일
편집: Jan 2012년 7월 6일
No. It is obvious that one or more of the elements are not scalar. Please try:
dbstop if error
Then run your code again until it stops with the error message. Then type in the command window:
size(u)
size(uc)
size(y)
size(yc)
size(d)
This procedure is called "debugging" and it is even more powerful than this forum.
It is pure guessing only, but in some fonts the "1" (one) looks like a "l" (lowercase L), so please check if there is really a one in "yres(1)". General rule: Never use l (lowercase L) and O (uppercase oh) as names.
  댓글 수: 1
Hana
Hana 2012년 7월 6일
thanks a lot :)

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by