Cody

Problem 42776. "Power matrix" of two vectors

Solution 1687589

Submitted on 6 Dec 2018 by Martin C.
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:4); y=(5:9); M=[1, 1,1,1,1;32,64,128,256,512;243,729,2187,6561,19683;1024,4096,16384,65536,262144]; assert(isequal(pow_mat(x,y),M))

M = 1 M = 1 1 M = 1 1 1 M = 1 1 1 1 M = 1 1 1 1 1 M = 1 1 1 1 1 32 0 0 0 0 M = 1 1 1 1 1 32 64 0 0 0 M = 1 1 1 1 1 32 64 128 0 0 M = 1 1 1 1 1 32 64 128 256 0 M = 1 1 1 1 1 32 64 128 256 512 M = 1 1 1 1 1 32 64 128 256 512 243 0 0 0 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 0 0 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 0 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 19683 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 19683 1024 0 0 0 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 19683 1024 4096 0 0 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 19683 1024 4096 16384 0 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 19683 1024 4096 16384 65536 0 M = 1 1 1 1 1 32 64 128 256 512 243 729 2187 6561 19683 1024 4096 16384 65536 262144

Suggested Problems

Community Treasure Hunt

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

Start Hunting!