I'm trying to create a matrix of odd numbers, and I'm having some trouble. Any ideas? Thanks
14 ビュー (過去 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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!