This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full 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
 Spring '08
 Instuctor
 matlab

Click to edit the document details