Take the tour ×  I'm stumped. What is going on with MATLAB's
syntax?  clear all;  dx = .1; for n=1:length(x)     int_f(n) =
f(n)*dx+int_f(n); share|improve this question What happens when
you do this and what do you expect to happen –  Dan Dec 10 '11
at 3:35 Define "not working." In exact terms. –  Matt Ball Dec
10 '11 at 3:36 The plot is a nonsensical dataset that is 1
dimensional. This should not be the case. That code is
implementing an integral of x^2. –  nick_name Dec 10 '11 at 3:38
add comment  2 Answers  up vote 6 down vote accepted  I think
you should be plotting that using plot(x,int_f); that way you
plot the two arrays rather than one array against one single
number.  Also your integral step is wrong, it should be int_f(n)
= f(n)*dx+int_f(n-1) except for the first run, where it should
be int_f(n) = f(n)*dx  share|improve this answer Wow, my bad.
Thanks for the response! –  nick_name Dec 10 '11 at 3:40 add
comment  Because in plot(x,int_f(n));, x is a row vector, but
int_f(n) is a scalar value. You s