I'm trying to create a matrix of odd numbers, and I'm having some trouble. Any ideas? Thanks
조회 수: 8 (최근 30일)
이전 댓글 표시
function orms=odd_rms(nn)
lim = (nn * 2)-1;
odds = nums(1:2:lim); PROBLEM IS WITH THIS LINE
%(1:1:nn) = (odds(1:1:nn)^2);
%sumsquares =sum(squares)/nn;
orms =odds;
end
댓글 수: 1
Duddela Sai Prashanth
2016년 12월 23일
This will help you dear
function O = odd_rms(n)
n = n*2-1;
O = [1:2:n];
O = O.^2;
O = sum(O)/n;
O = sqrt(O);
답변 (1개)
Ahmet Cecen
2016년 11월 12일
You might have meant to do:
odds = 1:2:lim
as it is unclear what nums is in the scope of this function.
댓글 수: 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!