{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

E7_Lab06_Solutions_Fall_2010

# E7_Lab06_Solutions_Fall_2010 - E7 Laboratory Assignment 6...

This preview shows pages 1–3. Sign up to view the full content.

E7 Laboratory Assignment 6 Solutions Problem 1 function [] = indplot(M) sum1 = 0; sum2 = 0; for n = 1:M sum1 = sum1 + 2*n - 1; sum2 = sum2 + n^2; sum1array(n) = sum1; sum2array(n) = sum2; end plot(1:M, sum1array, 1:M, sum2array) figure(2) p = 1:M; plot(1:M, p.^2, 1:M, p.*(p+1).*(2*p+1)/6); 0 5 10 15 20 25 30 35 40 45 50 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 x 10 4 Figure 1: Summations as a function of M If statements are true for n , what about for ( n + 1)?

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

View Full Document
= = - N n N n 1 2 ) 1 2 ( + = + = - 1 1 2 ) 1 ( ) 1 2 ( N n N n 1 2 ] 1 ) 1 ( 2 [ ) 1 2 ( 2 1 + + = - + + - = N N N n N n 1 2 1 2 + = + N N ) 3 2 ( 6 1 6 ) 1 2 )( 1 ( 2 3 1 2 N N N N N N n N n + + = + + = = + = + + + + + = 1 1 2 6 ] 1 ) 1 ( 2 ][ 1 ) 1 )[( 1 ( N n N N N n = + + + = + + N n N N N N n 1 2 2 2 6 ) 6 7 2 )( 1 ( ) 1 ( ) 6 7 2 6 7 2 ( 6 1 ) 1 ( 2 2 1 3 2 2 + + + + + = + + = N N N N N N n N n ) 6 12 6 ( 6 1 ) 3 2 ( 6 1 ) 1 ( 2 2 1 3 2 2 + + + + + = + + = N N N N N N n N n ) 6 12 6 ( 6 1 ) 1 ( 2 2 + + = + N N
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

E7_Lab06_Solutions_Fall_2010 - E7 Laboratory Assignment 6...

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

View Full Document
Ask a homework question - tutors are online