Introduction to MATLAB 7 for Engineers Chapter 1 An ... - FET
Introduction to MATLAB 7 for Engineers Chapter 1 An ... - FET
Introduction to MATLAB 7 for Engineers Chapter 1 An ... - FET
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Example of a <strong>for</strong> LoopWrite a script file <strong>to</strong> compute the sum of the first15 terms in the series 5k 2 – 2k, k = 1, 2, 3, …,15.<strong>to</strong>tal = 0;<strong>for</strong> k = 1:15end<strong>to</strong>tal = 5*k^2 - 2*k + <strong>to</strong>tal;disp(’The sum <strong>for</strong> 15 terms is:’)disp(<strong>to</strong>tal)The answer is 5960.1-53