We have moved to @ Placement Papers Hub !! Visit our new website here for more..

Creating a vector X with elements, Xn = (-1)n+1/(2n-1) and Adding up 100 elements of the vector, X; And, plotting the functions, x, x3, ex and exp(x2) over the interval 0 < x < 4 (by choosing appropriate mesh values for x to obtain smooth curves), on (A). A Rectangular Plot (B). A Semi log Plot (C). A log-log Plot



>> n=1:100;
>> x=((-1).^(n+1))./(2*n-1);
>> X=x

X =

  Columns 1 through 7
    1.0000   -0.3333    0.2000   -0.1429    0.1111   -0.0909    0.0769

  Columns 8 through 14
   -0.0667    0.0588   -0.0526    0.0476   -0.0435    0.0400   -0.0370


  Columns 15 through 21
    0.0345   -0.0323    0.0303   -0.0286    0.0270   -0.0256    0.0244

  Columns 22 through 28
   -0.0233    0.0222   -0.0213    0.0204   -0.0196    0.0189   -0.0182

  Columns 29 through 35
    0.0175   -0.0169    0.0164   -0.0159    0.0154   -0.0149    0.0145

  Columns 36 through 42
   -0.0141    0.0137   -0.0133    0.0130   -0.0127    0.0123   -0.0120

  Columns 43 through 49
    0.0118   -0.0115    0.0112   -0.0110    0.0108   -0.0105    0.0103

  Columns 50 through 56
   -0.0101    0.0099   -0.0097    0.0095   -0.0093    0.0092   -0.0090

  Columns 57 through 63
    0.0088   -0.0087    0.0085   -0.0084    0.0083   -0.0081    0.0080

  Columns 64 through 70
   -0.0079    0.0078   -0.0076    0.0075   -0.0074    0.0073   -0.0072


  Columns 71 through 77
    0.0071   -0.0070    0.0069   -0.0068    0.0067   -0.0066    0.0065

  Columns 78 through 84
   -0.0065    0.0064   -0.0063    0.0062   -0.0061    0.0061   -0.0060

  Columns 85 through 91
    0.0059   -0.0058    0.0058   -0.0057    0.0056   -0.0056    0.0055

  Columns 92 through 98
   -0.0055    0.0054   -0.0053    0.0053   -0.0052    0.0052   -0.0051

  Columns 99 through 100
    0.0051   -0.0050


>> Y=sum(x)

Y =
    0.7829


1)

>> plot(x)















 >>plot(x(1,1:4)) 


 













>>semilogx(x(1,1:4))
















>>semilogy(x(1,1:4))
















>>loglog(x(1,1:4))
















2)


>> A=x.^2;


>> plot(A)

















>> plot(A(1,1:4))

















>>semilogx(A(1,1:4))
















>>semilogy(A(1,1:4))
















>>loglog(A(1,1:4))
















3)


>> B=exp(x);


>> plot(B)




  











>> plot(B(1,1:4))
















>>semilogx(B(1,1:4))
















>>semilogy(B(1,1:4))
















>>loglog(B(1,1:4))