Cody

# Problem 106. Weighted average

Solution 330712

Submitted on 8 Oct 2013 by !ntel
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = [1 2 3]; w = [10 15 20]; y_correct = 100/3; assert(isequal(weighted_average(x,w),y_correct)) x = [0 -2 3]; w = [10 0 10]; y_correct = 10; assert(isequal(weighted_average(x,w),y_correct))

y = 33.3333 y = 10

### Community Treasure Hunt

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

Start Hunting!
{"ft_lang_label":"__label__en","ft_lang_prob":0.71287775,"math_prob":0.9873396,"size":602,"snap":"2020-45-2020-50","text_gpt3_token_len":179,"char_repetition_ratio":0.117056854,"word_repetition_ratio":0.0,"special_character_ratio":0.34551495,"punctuation_ratio":0.13445379,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9796511,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-28T15:20:53Z\",\"WARC-Record-ID\":\"<urn:uuid:a6dd9d62-e32c-4070-8daa-e8fa5d6fbc30>\",\"Content-Length\":\"82165\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:0b09bf78-4742-4ac3-b930-88d791612adc>\",\"WARC-Concurrent-To\":\"<urn:uuid:5786cb0f-b223-4f7f-ab7d-ada17a2daf17>\",\"WARC-IP-Address\":\"23.223.252.57\",\"WARC-Target-URI\":\"https://www.mathworks.com/matlabcentral/cody/solutions/330712\",\"WARC-Payload-Digest\":\"sha1:KLCKXI5HCLQJVWDFEFIXSAKWRV7S3CDY\",\"WARC-Block-Digest\":\"sha1:FFCSACPNEOZ4BROOM5IC5AYJJX53ETC4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141195656.78_warc_CC-MAIN-20201128125557-20201128155557-00395.warc.gz\"}"}