MATLAB: Problem in generating iterations in 3/8 simpson rule

for loopsimpsons rulesym

I want to make simpson rule algorithm for my function for different intervals (here, 3^p), and plot the error vs p. The code below is showing error in the use of syms in 1st line and the iteration of line 9 (Itr=Itr+f(N+1)/2). Please tell what is wrong in this and how can I correct it.
syms pN=3^p;h=1/N;    for i=1,N;        x=i*h;        f(i)=exp(-x^2)        Itr=f(1)/2;        Itr=Itr+(3/2)*f(i);        Itr=Itr+f(N+1)/2;    end    Itr=Itr*h;for p=1,10;plot(p,itr)end Error using sym/subsindex (line 857)Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.Error in sym/subsref (line 902)            R_tilde = builtin('subsref',L_tilde,Idx);Error in simpson3by8rule (line 9)        Itr=Itr+f(N+1)/2;

% Integrate exp(-x^2) from x = 0 to x = 3 using Simpson's 3/8 rule % I = 3*h/8*(f(a))+sum(f(i)+f(i+1),i=2:3:n-2)+sum(f(i),i=3:3:n-1)+f(b))f = @(x) exp(-x.^2);   % functiona = 0;                 % lower limitb = 3;                 % upper limitn = 333;         % number of panels (multiple of 3)h = (b - a)/n;   % panel sizex = a:h:b;       % vector of x values  s3 = 0;         for j = 2:3:n-2    s3 = s3 + f(x(j)) + f(x(j+1)); ends2 = 0;for j = 3:3:n-1   s2 = s2 + f(x(j)); endI = 3*h/8*(f(a) + 3*s3 + 2*s2 + f(b));disp('Approximate integral of exp(-x^2) from x=0 to x=3 using')disp(['Simpson''s 3/8 rule with ' int2str(n) ' panels is: '  num2str(I,4)])