Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Summing data columns in a series
조회 수: 1 (최근 30일)
이전 댓글 표시
If I have a 2 data columns and I want to raise them to the power of K and sum the using sigma notation from k=1 to 10 how would I do that. So far I have tried.
Datacolumn1; %defined variables
Datacolumn2;
f=0;
for k=1:10
Data=(Datacolumn1.^k-Datacolumn2.^k).^2; %I want datacolumn1.^k minus datacolumn2.^k all squared summed(sigma notation) from k=1:10
f=f+Data
end
Have I entered that correctly. Any help would be appreciated.
댓글 수: 0
답변 (1개)
KALYAN ACHARJYA
2019년 10월 31일
편집: KALYAN ACHARJYA
2019년 10월 31일
I want to raise them to the power of K and sum the using sigma notation from k=1 to 10
k=?? % define
Data=Datacolumn1.^k+Datacolumn2.^k;
result=sum(Data(1:10));
If your code is correct? then
k=?? % define
Data=(Datacolumn1.^k-Datacolumn2.^k).^2;
result=sum(Data(1:10));
댓글 수: 3
KALYAN ACHARJYA
2019년 10월 31일
Is this?
k=?? % define
Data=(Datacolumn1.^k-Datacolumn2.^k).^2;
result=sum(Data(end-9:end));
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!