How can I use MATLAB to plot and sum values using vectors and matrices?

kobjob
Messages
6
Reaction score
0
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
 
Physics news on Phys.org
It would probably help if you wrote the question and what you are trying to do.
 
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.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top