Filter löschen
Filter löschen

Error in newton (line 79) fitness=fit_fun(nucsh).I am always getting this error,What would be the reason?

1 Ansicht (letzte 30 Tage)
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 Kommentare
Torsten
Torsten am 7 Feb. 2018
Bearbeitet: Torsten am 7 Feb. 2018
What is "fitness" ? The name appears nowhere in function "fit_fun".
swati paliwal
swati paliwal am 7 Feb. 2018
Fitness=1/(1+evreg).In starting evreg=0; But still the same error

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

swati paliwal
swati paliwal am 7 Feb. 2018
Fitness=1/(1+evreg).In starting evreg=0;

Weitere Antworten (2)

Torsten
Torsten am 6 Feb. 2018
I don't see the array "fitness" in "fit_fun" which you claim is the output of the function.
Best wishes
Torsten.

swati paliwal
swati paliwal am 13 Feb. 2018
Bearbeitet: Torsten am 13 Feb. 2018
fid=fopen('C:\Users\hp\Documents\MATLAB\vr_ga.dat');
if(fid==-1);
disp('file vr_ga.dat can not be open');
end
%...............printing in to file.............
nrow=1;
pl=0.7;
for n1=1:nrow-1;
fprintf(fid,'%10.6f\t%10.6f\t%10.6f\t%7.4e\t%10.6f\t%10.6f\t\n',......
vrxmf1(n1,1),vrxmf1(n1,2), vrxmf1(n1,3), vrxmf1(n1,4), vrxmf1(n1,5),vrxmf1(n1,6));
end
fclose(fid);
fopen(fid,'%8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f \n',prn,isss,irrms,pl,iLrms,vt,pin,xm,freq,rL);
A=load('C:\Users\hp\Documents\MATLAB\ss1.dat');
pr=A(:,1)
is=A(:,2)
ir=A(:,3)
pL=A(:,4)
iL=A(:,5)
vt=A(:,6)
xm=A(:,8)
freq=A(:,9)
vr_ga.dat is data file and i want to load the results of all those parameters in "A" whose file name i have to made is ss1.dat. So that i can plot the figures....How can i generate this file ss1.dat and how can i load those data? Please help

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by