Finding positions and adding them together

% Author: Sean Walsh % Create a vector of 53 random #s and analyze them. disp('Your 53 random numbers are') r = rand([53,1]) disp('Their sum adds up to') sum(r) disp('When multiplied together, their product is') prod(r) disp('The mean of the vector is') mean(r) disp('The median of the vector is') median(r) disp('The stand deviation ofthe vector is') std(r) disp('The length of the vector is') length(r) disp('The size of the vector is') size(r) disp('The minimum value of the vector is') min(r) disp('The maximum value of the vector is') max(r)
Question: How can I find the value in positions 2, 15,22, and 35 and add them together?

댓글 수: 1

Matt J
Matt J 2013년 1월 31일
BTW, you can make your code more readable using the '{} Code' formatting toolbar icon.

댓글을 달려면 로그인하십시오.

 채택된 답변

추가 답변 (1개)

Sean
Sean 2013년 1월 31일

0 개 추천

Thank you very much! I've been working on this darn lab for 4+ hours.. I'm so glad I found this website; and you guys who answer are amazing:)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2013년 1월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by