Help! About use symsum on matrix
Ältere Kommentare anzeigen
Hello, i am a freshman on matlab
it's a problem about summation of matrix
m=2;
p=[2,3;3,5]; %matrix 2*2
yu=[34;44]; %column vector 2*1
syms t;
rt=symsum((p^t)*yu,t,0,m);
what i want should be the followings:
>> (p^0)*yu+ (p^1)*yu+ (p^2)*yu
ans =
1600
2576
however, i get this
>> rt
rt =
matrix([[102, 102], [102, 204]])
matrix([[132, 132], [132, 264]])
I don't know why
Please help me
Thanks a lot!
Akzeptierte Antwort
Weitere Antworten (1)
Paulo Silva
am 7 Mai 2011
Your are missing a dot before the exponent
rt=symsum((p.^t)*yu,t,0,m);
5 Kommentare
zhang
am 7 Mai 2011
Paulo Silva
am 7 Mai 2011
I can't find the problem, if you do
syms t p yu
rt=symsum((p.^t)*yu,t,0,m)
you get the same expressions (p^0)*yu+(p^1)*yu+(p^2)*yu
but with p and yu replaced by the array it's not the same, sorry
Paulo Silva
am 7 Mai 2011
also if you choose m=0 it should give yu but it gives [78;78] , 78 is the sum of yu values
zhang
am 7 Mai 2011
zhang
am 8 Mai 2011
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!