- #1
eurekameh
- 210
- 0
How can I do the summation of x^2 from 0 to 3 without the use of any built-in functions? I know a for loop is involved, but I can't get it to work.
Last edited by a moderator:
I'm not a Matlab user, but does x already store each i^2? There are a couple of ways you could do this: using a loop or a vectorized approach.eurekameh said:Lol, it's not an assignment per se, but I still need this piece of code.
I tried:
i = 0:1:3
x = i.^2
end
but this just uses each i = 1, i = 2, i = 3 to compute x = i^2. I'm looking for a way to somehow store each xi and add them to form the total summation.
"Summation x^2 0-3 w/o Built-in Matlab Fns: For Loop" is a mathematical concept that involves calculating the sum of the squares of a series of numbers from 0 to 3 without using any built-in functions in the Matlab software.
Calculating this summation without using built-in functions can help improve a scientist's understanding of the underlying mathematical concepts and can also be useful in situations where built-in functions may not be available or appropriate.
To perform this summation using a for loop in Matlab, you can use a loop counter to iterate through the series of numbers and use the loop counter variable to calculate and store the sum of the squared values.
Yes, this summation can be performed using for loops or other iterative methods in other programming languages such as Python, Java, or C++. The specific syntax may vary, but the underlying concept remains the same.
Using this method can be advantageous for educational purposes or in situations where built-in functions may not be available. It can also be useful in scenarios where the series of numbers is not a continuous range and may require additional manipulation before using built-in functions.