Rotating a protein
% rotate a protein structure
% Note that a*ones(n,1)/n does this without the loop
fid = fopen('1.CRD');
a = fscanf(fid,'%g %g %g',[3 inf]);
n = max(size(a));
u=[0 , -1 , 0 ; 1 , 0 , 0; 0 , 0 , 1];
center = [0 , 0 , 0]';
for i=1:n;
center=a(:,i) + center;
end
center = center/n
for i=1:n;
a(:,i) = a(:,i)-center;
b(:,i) = u*a(:,i);
end
Previous slide
Next slide
Back to first slide
View graphic version