解決済み


Given a matrix A (size m x n) create a matrix B (size m+2 x n+2) which consists of matrix A surrounded by zeros. See Example below:
A = [1 2 3 4 5 6] ----------- B = [0 0 0 0 0 0 1 2 3 0 0 4 5 6 0 0 0 0 0 0]

2年弱 前

解決済み


Given a Vector v1, create v2 which is the sum of each two adjacent elements in v1. {length(v2)=length(v1)-1}
if v1 is [1 2 3 4 5 6 7 8] then v2 should be [3 5 7 9 11 13 15]. if v1 is [1; 3; 5; 7] the...

2年弱 前

解決済み


Given a matrix A (size m x n) create a matrix B which consists of matrix A sorted in descending order by columns and then by rows.
--------------- A= [ 2 6 -3 7 12 0 -12 5 1] --------------- B= [12 7 1 6 2 0 5 -3 ...

2年弱 前

解決済み


Given a matrix A return a vector of the product of the elements in each column using a loop without using prod.
--------------------- for m: 3 1 3 3 10 1 9 1 9 4 1 4 5 6 5 ...

2年弱 前

解決済み


Horizontal matrix sort
Given a matrix x with n rows and m columns, return a matrix y with n rows and 2m columns, such that every row in x is sorted fro...

2年弱 前

解決済み


Separate even from odd numbers in a vector - with a loop
*Using a loop*, rearrange a vector of integers such that the odd numbers appear at the beginning, and even numbers at the end. T...

2年弱 前

解決済み


Average of even-numbered columns
Given a vector, find the average of even-numbered columns. e.g x = [ 4 6 8 9 1 2 7 ] y = ( 6 + 9 + 2 ) / 3

2年弱 前

解決済み


determine the sum of decimal part for given matrix
determine the sum of fraction part for the given matrix

2年弱 前

解決済み


"Power matrix" of two vectors
Given two row vectors x,y of lengths m and n (respectively), create an m x n matrix whose i,j entry is x(i)^y(j).

2年弱 前

解決済み


Divisible by n, prime divisors from 20 to 200
Pursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers ...

2年弱 前

解決済み


Divisible by n, Composite Divisors
Pursuant to <http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors Divisible by ...

2年弱 前

解決済み


Divisible by n, Truncated-number Divisors
Some divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Exa...

2年弱 前

解決済み


Leader
An element of a list is called a "leader" if every element to its right (and not just the one immediately to its right) is stric...

2年弱 前

解決済み


That's some divisor you've got there...
Given a positive integer x, calculate the sum of all of the divisors of the number. Please include the number itself in your fi...

2年弱 前

解決済み


Repeat middle rows and columns of an array
Given an MxN numeric array (A), return an array (B) in which the middle rows and columns have each been repeated once. It may be...

2年弱 前

解決済み


Component area
Find the area of the component below, all measurements are in mm <<https://image.ibb.co/hocruF/Component.png>>

2年弱 前

解決済み


Euclidean inter-point distance matrix
The Euclidean distance between two points in a p-dimensional space is a really common thing to compute in the field of computati...

2年弱 前

解決済み


Extract the Acrostic Message
An acrostic cipher is a way of embedding one message within another by taking the first (or last) word of each line. Given a str...

2年弱 前

解決済み


Get a Fibonacci number's index.
*N.B.* For the purpose of this exercise, the first Fibonacci number is 1, and the second is 2; that is, |fib(1) = 1| and |fib(2)...

2年弱 前

解決済み


Trickier Timing
You solution should return control to main program only when the current time ends in either a 5 or 0 (e.g. the current seconds ...

2年弱 前

解決済み


Tricky timing
Write a function that takes between 0.5 seconds and 0.6 seconds to run.

2年弱 前

解決済み


Back to basics 17 - white space
Covering some basic topics I haven't seen elsewhere on Cody. Remove the trailing white spaces from the input variable

2年弱 前

解決済み


Back to basics 15 - classes
Covering some basic topics I haven't seen elsewhere on Cody. Return the class of the input variable.

2年弱 前

解決済み


Assignment Problem
Given a matrix where row i corresponds to person i, and column j corresponds to task j and cell (i,j) corresponds to the time ta...

2年弱 前

解決済み


Factorizing a number into a given number of factors
Given a positive integer, n, and another positive integer, b, return a matrix, M, of width b, with the following properties: (a)...

2年弱 前

解決済み


Find maximum value of a curve
Two vectors shall be already defined: - Input vector x (e.g. x = 0:1:10) - Result vector y (e.g. y = sin(x)) Create a n...

2年弱 前

解決済み


The last non-zero digit of a factorial
For given positive integer n, what is the last non-zero digit of n!? Example: factorial(11) = 39916800 Last non-zero d...

2年弱 前

さらに読み込む