I'm have a really hard time understanding for loops in matlab. How can I solve y=x^3+1 with a for loop?
You're trying to raise a vector to a power; using "i^3" will attempt to multiply i*i*i, which is not what you want. The correct expression is "i.^3". You should be able to figure out what to do from there.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
this won't work
[COLOR="Blue"]for[/COLOR] i=0:01:2 y(i)=1+i^3 [COLOR="Blue"]end [/COLOR]