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 - The Fusion of Science and Community**

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

Loading...

Similar Threads - Help optimizing matlab | Date |
---|---|

C/++/# Help with MATLAB code? | Feb 9, 2018 |

What's wrong with my bisection method code? | Dec 10, 2017 |

Help: Convert Matlab to Python code | Dec 8, 2017 |

C/++/# Counterexamples to my claim? | May 30, 2017 |

**Physics Forums - The Fusion of Science and Community**