10.07.2015 Views

Elements of MATLAB and Simulink - Lecture 1 - Percro

Elements of MATLAB and Simulink - Lecture 1 - Percro

Elements of MATLAB and Simulink - Lecture 1 - Percro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Loop vs Indexed Operations• When programming in <strong>MATLAB</strong> prefer indexed operations respectloop operations• Exploit: find, sum, min• Exploit Vectorized logic• Example Vector Normalization:– vMag = sqrt(sum(v.ˆ2));– v = v./vMag(ones(1,size(v,1)),:);See Writing fast <strong>MATLAB</strong> Code

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!