kschul14
- 2
- 0
I'm have a really hard time understanding for loops in matlab. How can I solve y=x^3+1 with a for loop?
The discussion revolves around solving the equation y=x^3+1 using a for loop in MATLAB. Participants explore the implementation of for loops, the use of the dot operator, and the requirements of an assignment that specifies a uniform distribution of points over a defined range.
Participants do not reach a consensus on the best approach to solve the problem, with differing opinions on the necessity of for loops versus vectorization and the appropriateness of the assignment requirements.
There are unresolved issues regarding the correct implementation of indexing in MATLAB, the use of the dot operator, and the overall approach to solving the equation within the constraints of the assignment.
kschul14 said:it's an assignment. we are supposed to use the dot operator which is really easy and a for loop and the range is 0<=x<=2 with 100 points distributed uniformly. I have tryed the fallowing
for i=0:01:2
y(i)=1+i^3
end
this won't work
for i=0:01:2
y(i)=1+i^3
end