% problem 1 n = 1:1000; sqrt(16*sum(1./((2*n-1).^2.*(2*n+1).^2)) +8) % problem 2 x = [ 2 5 1 6] x = x + 16 x([1 3]) = x([1 3]) + 3 x = sqrt(x) x = x .^ 2 % problem 3 x = linspace(0,4,100); plot(x,x,'b') hold on plot(x,x.^3,'r') plot(x,exp(x),'g') plot(x,exp(x.^2),'k') xlabel('x') % restrict the axis using this % [ xmin xmax ymin ymax ] axis( [ min(x) max(x) 0 100 ] ) % add a legend % note: -1 puts it outside the plot area legend(-1,'x','x^3','e^x', 'e^x^2')