I'd like to calculate the sum of a columns in a Matrix in Matlab and assign the value to another Matrix without a for loop (as I will be needed to do lots of these with little variations in the sum formula and writing for-loops for each of these would be silly).
Here is what I have so far:
finalmatrix= [
symsum((sample1Prime(i)-sample1(i))^2, i, 1, 10);
]
Note this would be one index of the final matrix.
I keep getting an error saying symsum is invalid for arguments of type double.. And a quick Google search tells me that it cannot be used for non-symbolic expressions. But no further solutions are given that meet my requirements.
Essentially what I'm trying to calculate is: The sum from i = 1 to 10 of sample1Prime(i)-sample1(i))^2 where sample1Prime and sample1 are 10x1 Matrices.
Anyone have any ideas?
Thanks.
sumsince your variables do not seem to be symbolic ? - High Performance Mark