Error in newton (line 79) fitness=fit_fun(nucsh).I am always getting this error,What would be the reason?
2 ビュー (過去 30 日間)
古いコメントを表示
function newton
clear all
clc
close all
global pufmn pufmx xmmn xmmx
global ismx vlmn vlmx
global pmax MRT_55 otprmx
% ............Machine 5.5 kw rating data......................
vrtd=300;
pr=5500;
prp=pr/3;
zbase=25.23;
r1=0.0632;
r2=0.0247;
x1=0.0633;
x2=0.0633;
MRT_55=[vrtd;prp;zbase;r1;r2;x1;x2];
pmax=100; %Load points
%....... Max and min values of variables......................
xmmn=1.0; % magnetizing reactance
xmmx=3.48;
ismx=1.2;
vlmn=1.2; %minimum load voltage
vlmx=1.2;
pl=0.7;
otprmx=0.6;
%pufmn=0.95;
%pufmx=1;%max.output power at specified voltage regulation
%..................................
nnu=160; % no of points generated for pu speed
ncsh=160; % no of points generated for pu capacitor
nmx=160; % no of chromosomes
nmx1=nmx;
cshmx=30; %cap value range
cshmn=15;
numn=0.85; %generated range of speed
numx=1.15;
i=1; % csh=cshmn+(cshmx-cshmn)*(1:1:rnd)./rnd;
%nuv=numn+(numx-numn)*(1:1:rndn)./rndn;
rowmx=1000;
vrxmf=zeros(rowmx,6); % preallocation
nrow=1;
cycmx=25;
itrmx=10;
eps=0.990;
%.............memory allocation...............
fitestvar=zeros(cycmx,3);
fitestvarsrt=zeros(cycmx,3);
bststr=[];
for itr=1:itrmx
nu=numn+(numx-numn).*rand(nnu,1); %randomly generated points
csh=cshmn+(cshmx-cshmn).*rand(ncsh,1); %randomly generated points
vnucsh=[nu csh] ;
cyc=1;
while(cyc<cycmx)
var=[];
nro=0; % no of feasible fitness
for n=1:nmx
%........ fitness calculation..................
% vnucsh(n,1)= pufmx/1;
%vnucsh(n,1)=pufmn/0.95;
pufmx=vnucsh(n,1)*1.00 ; % varible constarints on puf
pufmn=vnucsh(n,1)*0.9;
nucsh=[vnucsh(n,1);vnucsh(n,2)];
fitness=fit_fun(nucsh);
if(fitness~=0)
var=[var;fitness nucsh(1) nucsh(2)]; % calling fitness function
nro=nro+1;
end
vardmy=sortrows(var,-1);
vardmy1=vardmy(1,:); % one highest fitness variable
maxvarfit=vardmy1(1); % maximum fitness
function [fitness]=fit_fun(nucsh0)
global pufmn pufmx xmmn xmmx
global ismx vlmn vlmx
global pmax MRT_55 otprmx
global PAR
vrtd=MRT_55(1);
prp=MRT_55(2);
zbase=MRT_55(3);
r1=MRT_55(4);
r2=MRT_55(5);
x1=MRT_55(6);
x2=MRT_55(7);
evreg=0;
inxmf=[xmmx-0.2;pufmx-0.1]; % [puf,xm] initial values of base point
nu=nucsh0(1);
csh=nucsh0(2);
for p=0.1:10:pmax+20; % power loop
prn=prp*p/pmax;
rL=vrtd^2/(prn*zbase);
xc=1/(100*pi*csh*zbase);
PAR=[r1;r2;x1;x2;nu;xc;rL];
5 件のコメント
採用された回答
その他の回答 (2 件)
Torsten
2018 年 2 月 6 日
I don't see the array "fitness" in "fit_fun" which you claim is the output of the function.
Best wishes
Torsten.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!