Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

error in performing summation

조회 수: 2 (최근 30일)
kash
kash 2012년 1월 9일
마감: MATLAB Answer Bot 2021년 8월 20일
I have an equation
summation i= 1 to n,Q^2ir/(Mi+M+r)
where
n=99
S=2
qir is the number of samples with class i (i = 1,2,. . . ,S, and r = 1,2,. . . ,n) in the interval (dr-1,d),Mi+ is the total number of samples with class i, and M+r is the total number of samples in the interval (dr-1,d)
Mi+=60
wen i calculate i get only one value,but the outout must be of many values..please help
  댓글 수: 3
kash
kash 2012년 1월 9일
for i=1:2
for r=1:99
Z=ceil(sum(q(i,r).^2)
end
end
kash
kash 2012년 1월 9일
if my code is wrong can u please code for me

답변 (1개)

Daniel Shub
Daniel Shub 2012년 1월 9일
I am guessing that if x is your answer that you want to have many values that you are doing something like
x = calc(a,b,c,i)
instead of
x(i) = calc(a,b,c,i)
also don't forget to preallocate x.
EDIT based on your comment to the question:
Z(i,r) = ceil( ...
you also probably want to add:
Z = zeros(2, 99);
before the loops.
  댓글 수: 1
kash
kash 2012년 1월 9일
for i=1:2
for r=1:99
Z=ceil(sum(q(i,r).^2)
end
end
this is the code
Daniel can u say what is (a,b,c)
if my code is wrong can u please code for me

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by