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 [email protected] 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. Don’t 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 Newton’s 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
This note was uploaded on 01/21/2012 for the course MATH 98 taught by Professor Instuctor during the Spring '08 term at Berkeley.
 Spring '08
 Instuctor
 matlab

Click to edit the document details