Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab plotting and summation

  1. Sep 14, 2011 #1
    Hi everyone,

    Could someone please tell me how to get matlab to do the following seemingly simple task..

    j=1:3;
    k1=1:3;
    m=eye(3)

    plot(j,symsum((p8+k1(j)).*m(p8,j),p8,1,3))

    or,

    k=1:3;
    plot(j,sum((k+k1(j)).*m(k,j)))

    Thanks for any suggestions,
    Kate
     
  2. jcsd
  3. Sep 14, 2011 #2
    It would probably help if you wrote the question and what you are trying to do.
     
  4. Sep 14, 2011 #3
    Well k1 is a vector with entries 1 to 3, k1=(1 2 3).
    m is the 3 x 3 identity matrix.

    For each j, I want to do the sum from k= 1 to 3
    sum((k+k1(j)).*m(k,j)) = (1+k1(j))*m(1,j) + (2+k1(j))*m(2,j) + (3+k1(j))*m(3,j)

    Then I want to plot the values of the sum for each j.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook