How to store values as array
조회 수: 1 (최근 30일)
이전 댓글 표시
How do you store all k values as a single array?
for ii = nn
k = ((-1).^(ii-1)).*((xx^(2.*(ii-1))))./(factorial(2.*(ii-1)));
end
댓글 수: 0
채택된 답변
per isakson
2017년 10월 26일
편집: per isakson
2017년 10월 26일
There are a couple of mistakes in your code. Try this
k = nan( 1, nn ); % pre-alloctate memory
for ii = 1 : nn
k(ii) = ((-1).^(ii-1)).*((xx^(2.*(ii-1))))./(factorial(2.*(ii-1)));
end
assert( all(not(isnan(k))) )
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!