It's hard to tell without knowing what's the error. The line with "SET" may be wrong syntax.
Genetic Algorithm and FEA
1 次查看(过去 30 天)
显示 更早的评论
I am trying to do an optimization of a structure using GEnetic Algorithm. I wrote the MATLAB code for the fitness function below but it produces an error. The structure is designed in ANSYS.
L is the variable that will be read in from an input file. The file Stress.txt is the output of the ansys code wich will be read and used by the GA solver. I tried using the GA Toolbox GUI here.
function y = fitness(l)
l1=abs(l(1));
l2=abs(l(2));
fid=fopen('length.inp');
fprintf(fid,'l1=%f\n',l1);
fprintf(fid,'l2=%f\n',l2);
fclose(fid);
SET KMP_STACKSIZE=4096k & "C:\Program Files\ANSYS Inc\v192\ansys\bin\winx64\ANSYS192.exe" -b -p -i "C:\Users\Asus\Desktop\ANSYS\ansys_files\ansys_file.txt" -o "C:\Users\Asus\Desktop\Intro to ANSYS\ansys_files\output.txt"
fid=fopen('Stress.txt','r');
stress=fscanf(fid,'%f',[1,1]);
fclose(fid);
if((stress/250)<1)
y=(stress/250);
else
y=10000000;
end
Please help me find the cause of the error
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!