Ok, so i wrote a small matlab program but it takes forever for matlab to calculate it. Since i'm not very knowledgeable in optimizing code i hoped somebody could help me here. The only thing i did was use preallocation of my variable 'conditionnr'. The H matrix i'm using is a pretty big one (433x270 double).(adsbygoogle = window.adsbygoogle || []).push({});

Code (Text):

k=1;

conditionnr = zeros(1,size(H,1));

while(k<size(H,1)+1)

for i=1:size(H,1)

Htemp = H;

H(i,:)=[];

conditionnr(i) = max(svd(H))/min(svd(H));

H=Htemp;

end

[m,j] = min(conditionnr);

H(j,:)=[];

if size(H,1)==size(H,2)

k=size(H,1)+1;

end

end

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Help optimizing matlab code

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**