Lecture9 - Lecture 9: Writing Fast Matlab Code Cinna Wu

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 9: Writing Fast Matlab Code Cinna Wu cinnawu@math.berkeley.edu Department of Mathematics University of California, Berkeley Math 98 Introduction to MATLAB programming Announcements HW4 is due this Thursday! Optimization Guidelines The main three Comment: Optimized codes tend to be harder to read. Remember to comment. Only optimize when it is time: Decide if it is worth it before optimizing. Dont do it until you have a working code. Only optimize where needed Make sure you are optimizing something that actually needs to be optimized. Check it is a bottleneck first. Tools Tic Toc Measures time in matlab. Look up in help menu. Exercise Use tic toc to measure the time it takes for Newtons algorithm to converge. Compare the speed with computing sqrt(5) in matlab. Tools Profiler Helps to find the bottlenecks in a program. Use profile on to turn the profiler on and profile viewer to view the profile....
View Full Document

Page1 / 9

Lecture9 - Lecture 9: Writing Fast Matlab Code Cinna Wu

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online