function [] = elasticAnalysis() % Run first simulation meshCoordinates = 0; maxIterations = 5; for i=1:maxIterations % Begin loop [inCoord,outCoord,model] = eyeModel(meshCoordinates); if meshCoordinates == 0 finalMesh = inCoord; displacements = zeros(3,length(finalMesh),maxIterations); displacements(:,:,i) = calculateDisplacements(outCoord,finalMesh); condition = 1; else displacements(:,:,i) = calculateDisplacements(outCoord,finalMesh); condition = determineCondition(displacements(:,:,i),displacements(:,:,i-1)); end % figure(1) % grid on % hold on % plot3(inCoord(1,:),inCoord(2,:),inCoord(3,:),'r.') % figure(2) % grid on % hold on % plot3(outCoord(1,:),outCoord(2,:),outCoord(3,:),'b.') if condition == 1 meshCoordinates = inCoord - displacements(:,:,i); else break; end modelName = fullfile(cd,['Iteration=',num2str(i)]); model.save(modelName); end end