fsolve does not work anymore

I tried to use fsolve in Matlab2013a, but it doesn't work anymore. Is is changed to fzero?
Here is my code:
x(:,1)=table(:,1);
x(:,2)=table(:,2)*10/60*2*pi;
x(:,3)=table(:,3)/100;
F=@(c)x(:,1).*x(:,2)./(c(1)*(x(:,1)/(3/2*1/2*c(2))).^2+x(:,2).*x(:,1)/(3/2*1/2))-x(:,3);
c0=[0.5,2];
options=optimset('Display','iter');
c1=fzero(F,c0,options);
But there is an error:
Error using fzero (line 233)
FZERO cannot continue because user supplied function_handle ==>
@(c)x(:,1).*x(:,2)./(c(1)*(x(:,1)/(3/2*1/2*c(2))).^2+x(:,2).*x(:,1)/(3/2*1/2))-x(:,3)
failed with
the error below.
Attempted to access c(2); index out of bounds because numel(c)=1.
Error in twtable (line 82)
c1=fzero(F,c0,options);
What's going on here?
Thank you very much for your help!
Fan

 채택된 답변

Matt J
Matt J 2013년 6월 30일
편집: Matt J 2013년 6월 30일

0 개 추천

If you no longer have the Optimization Toolbox, you can probably get away with FMINSEARCH instead, since it is only a 2-parameter problem
c1 = fminsearch(@(c) norm(F(c)) , c0)

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 6월 30일

1 개 추천

fsolve() was not changed to fzero(). fzero() is a different routine that takes different arguments than fsolve() does.
fsolve() is part of the Optimization Toolbox, which you perhaps have not installed or not licensed for your R2013a system.

카테고리

도움말 센터File Exchange에서 Optimization에 대해 자세히 알아보기

질문:

Fan
2013년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by