| Thread Closed |
Need help creating a recursive script in matlab that can do this: |
Share Thread | Thread Tools |
| Jul30-10, 02:35 AM | #1 |
|
|
Need help creating a recursive script in matlab that can do this:
Need help creating a recursive script in matlab that can do this:
S = 1^2 + 2 ^2 + 3^2 + ... + n^2 : P Thanks. |
| Jul30-10, 05:54 AM | #2 |
|
|
This should do it:
S = sum((1:n).^2); (1:n) creates an array of integers from 1 to n the .^2 squares each element and the sum() function does what it says. |
| Thread Closed |
| Thread Tools | |
Similar Threads for: Need help creating a recursive script in matlab that can do this:
|
||||
| Thread | Forum | Replies | ||
| Recursion in C | Programming & Comp Sci | 12 | ||
| function is F(n) = n(n+1) | General Math | 4 | ||
| Recursion | General Physics | 6 | ||
| Recursion | General Math | 0 | ||
| What is the largest number of pieces you can get by cutting a pizza | Introductory Physics Homework | 1 | ||