Cody

Problem 42626. UICBioE240 2.7

Solution 1867658

Submitted on 8 Jul 2019 by jo gayong
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
x1 = [11 10 2]; x2 = [4 4 3]; y_correct = zeros(3,3,3); y_correct(:,:,1) = [44 44 33; 40 40 30; 8 8 6]; y_correct(:,:,2) = [704 704 297; 640 640 270; 128 128 54]; y_correct(:,:,3) = [96.8 96.8 72.6; 80 80 60; 3.2 3.2 2.4]; assert(sum(sum(sum(abs(your_fcn_name(x1,x2)-y_correct))))<1e-3)

ans(:,:,1) = 44 44 33 40 40 30 8 8 6 ans(:,:,2) = 704 704 297 640 640 270 128 128 54 ans(:,:,3) = 96.8000 96.8000 72.6000 80.0000 80.0000 60.0000 3.2000 3.2000 2.4000

2   Pass
x1 = [1 2 3]; x2 = [1 5 9]; y_correct = zeros(3,3,3); y_correct(:,:,1) = [1 5 9; 2 10 18; 3 15 27]; y_correct(:,:,2) = [1 125 729; 2 250 1458; 3 375 2187]; y_correct(:,:,3) = [0.2 1.0 1.8; 0.8 4.0 7.2; 1.8 9.0 16.2]; assert(sum(sum(sum(abs(your_fcn_name(x1,x2)-y_correct))))<1e-3)

ans(:,:,1) = 1 5 9 2 10 18 3 15 27 ans(:,:,2) = 1 125 729 2 250 1458 3 375 2187 ans(:,:,3) = 0.2000 1.0000 1.8000 0.8000 4.0000 7.2000 1.8000 9.0000 16.2000

3   Pass
x1 = [-4 7 9]; x2 = [3 2 11]; y_correct = zeros(3,3,3); y_correct(:,:,1) = [-12 -8 -44; 21 14 77; 27 18 99]; y_correct(:,:,2) = [-108 -32 -5324; 189 56 9317; 243 72 11979]; y_correct(:,:,3) = [9.6 6.4 35.2; 29.4 19.6 107.8; 48.6 32.4 178.2]; assert(sum(sum(sum(abs(your_fcn_name(x1,x2)-y_correct))))<1e-3)

ans(:,:,1) = -12 -8 -44 21 14 77 27 18 99 ans(:,:,2) = -108 -32 -5324 189 56 9317 243 72 11979 ans(:,:,3) = 9.6000 6.4000 35.2000 29.4000 19.6000 107.8000 48.6000 32.4000 178.2000

Suggested Problems

More from this Author27

Community Treasure Hunt

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

Start Hunting!