📄 da_svmod.m
字号:
%
% da_svmod.m
%
% .m file to save the best model produced
% using the GA model building procedures
%
% Saves the data to a .txt file which
% details what do with each variable.
%
%
% Determine which variable is the output
%
[D L]=size(output_var);
for i = 1 : L
if output_var(i) == 1
out=i;
break;
end
end
%
% Get a file name
%
[df_name df_path]=uiputfile('*.txt','Please select a results file');
%
% If the user actually entered something sensible
% then save the output
%
if df_name ~= 0
%
% Change to the directory
%
[D L]=size(df_path);
df_path=df_path(:,1:L-1);
eval(['cd ' num2str(df_path)]);
%
% Open the file
%
fid=fopen(df_name,'w');
%
% Print a header to the file:
%
fprintf(fid,'Model Result file:');
fprintf(fid,'\n','');
fprintf(fid,'----- ------ -----');
%
% Display the coefficients
%
fprintf(fid,'\n','');
fprintf(fid,'Model coefficients');
fprintf(fid,'\n','');
fprintf(fid,'----- ------------');
fprintf(fid,'\n','');
fprintf(fid,'Variable Coefficient');
fprintf(fid,'\n','');
%
% Display them:
%
[D L]=size(data);
count=1;
for i = 1:L
if include_var(i) == 1 & out ~= i
temp=[i ; c(count)];
fprintf(fid,'\n %3i %8.5f',temp);
count=count+1;
elseif include_var(i) == 0
temp=[i ; 0];
fprintf(fid,'\n %3i %8.5f',temp);
end
end
%
% Now display the Maxima and minima
%
% Display the coefficients
%
fprintf(fid,'\n \n \n','');
fprintf(fid,'Maximum and Minimum values');
fprintf(fid,'\n','');
fprintf(fid,'------- --- ------- ------');
fprintf(fid,'\n','');
fprintf(fid,'Variable Min Max');
fprintf(fid,'\n','');
%
% Display them:
%
[D L]=size(data);
count=1;
for i = 1:L
if include_var(i) == 1 & out ~= i
temp=[i ; mx(count) ; sdx(count)];
fprintf(fid,'\n %3i %8.5f %8.5f',temp);
count=count+1;
elseif include_var(i) == 0
temp=[i ; 0 ; 0];
fprintf(fid,'\n %3i %8.5f %8.5f',temp);
end
end
if p ~= 0
%
% Now display the Polynomial powers
%
% Display the coefficients
%
fprintf(fid,'\n \n \n','');
fprintf(fid,'Polynomial powers');
fprintf(fid,'\n','');
fprintf(fid,'---------- ------');
fprintf(fid,'\n','');
fprintf(fid,'Variable Power');
fprintf(fid,'\n','');
%
% Display them:
%
[D L]=size(data);
count=1;
for i = 1:L
if include_var(i) == 1 & out ~= i
temp=[i ; p(count)];
fprintf(fid,'\n %3i %8.5f',temp);
count=count+1;
elseif include_var(i) == 0
temp=[i ; 0];
fprintf(fid,'\n %3i %8.5f',temp);
end
end
end
if f ~= 0
%
% Now display the filter constants
%
% Display the coefficients
%
fprintf(fid,'\n \n \n','');
fprintf(fid,'Filter constants');
fprintf(fid,'\n','');
fprintf(fid,'------ ---------');
fprintf(fid,'\n','');
fprintf(fid,'Variable Filter');
fprintf(fid,'\n','');
%
% Display them:
%
[D L]=size(data);
count=1;
for i = 1:L
if include_var(i) == 1 & out ~= i
temp=[i ; f(count)];
fprintf(fid,'\n %3i %8.5f',temp);
count=count+1;
elseif include_var(i) == 0
temp=[i ; 0];
fprintf(fid,'\n %3i %8.5f',temp);
end
end
end
%
% Display the maximum and minimum value of y
%
fprintf(fid,'\n \n','');
fprintf(fid,'Max value of y:');
fprintf(fid,'\n %10.5f',sdy);
fprintf(fid,'\n \n','');
fprintf(fid,'Min value of y:');
fprintf(fid,'\n %10.5f',my);
%
% Close the file
%
fclose(fid);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -