Afficher commentaires plus anciens
function a =myfun(Tw2,I2,P2)
Tm=1.5;
Te=0.5;
T0=0.05;
Jw2=pi./10;
a(1)=(Jw2+atan((2*pi*Tm)./Tw2)+atan((2*pi*Te)./Tw2)+(2*pi*T0)./Tw2)-pi;
a(2)=atan(Tw2./(2*pi*I2))-Jw2;
a(3)=((100./P2)*sqrt(1+(tan(Jw2))^2)*1./sqrt(1+(Tm*2*pi./Tw2)^2)*1./sqrt(1+(0.5*2*pi./Tw2)^2))-1;
end
/*******************************
********************************/
clear
Jw22=fsolve('myfun',[2,2,3]);
不知为什么出现错误?
Subscripted assignment dimension mismatch.
Error in myfun (line 6)
a(1)=(Jw2+atan((2*pi*Tm)./Tw2)+atan((2*pi*Te)./Tw2)+(2*pi*T0)./Tw2)-pi;
Error in fsolve (line 218)
fuser = feval(funfcn{3},x,varargin{:});
Error in Test (line 2)
Jw22=fsolve('myfun',[2,2,3]);
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB 快速入门 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!