Solved

Joining Ranges

You are given a n-by-2 matrix. Each row represents a numeric range, e.g. x = [0 5; 10 3; 20 15; 16 19; 25 25] contains...

1 year ago

Solved

Reindex a vector

You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...

1 year ago

Solved

Remove the two elements next to NaN value

The aim is to *remove the two elements next to NaN values* inside a vector. For example: x = [6 10 5 8 9 NaN 23 9 7 3 21 ...

1 year ago

Solved

Piecewise linear interpolation

Given an Mx2 vector and a row of M-1 integers, output a two column vector that linearly interpolates Y times between each succes...

1 year ago

Solved

Get the elements of diagonal and antidiagonal for any m-by-n matrix

In the problem <http://www.mathworks.com/matlabcentral/cody/problems/858-permute-diagonal-and-antidiagonal Problem 858. Permute ...

1 year ago

Solved

Replicate elements in vectors

Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2 3] -> [1 1 2 2 3 3] ...

1 year ago

Solved

First non-zero element in each column

For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

1 year ago

Solved

Set the array elements whose value is 13 to 0

Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

1 year ago

Solved

Fill a zeros matrix

The aim is to fill an array of all zeros given a numerical value and the index of row and columns for this value. 3 Inputs: ...

1 year ago

Solved

Getting the indices from a matrice

Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

1 year ago

Solved

Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock.

Submit your answer to this problem a multiple of 5 seconds after the hour. Your answer is irrelevant; the only thing that matte...

1 year ago

Solved

Energy of a photon

*⚛ ☢ ⚛ ☢ ⚛ ☢ ⚛* Given the frequency F of a photon in giga hertz. Find energy E of this...

1 year ago

Solved

Generate N equally spaced intervals between -L and L

Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

1 year ago

Solved

intersection of matrices

Given two matrices filled with ones and zeros, determine if they share a common row, column entry. These matrices are of identi...

1 year ago

Solved

We love vectorized solutions. Problem 1 : remove the row average.

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

1 year ago

Solved

Mid-term report

You just got your mid-term report, but it's full of ones and twos :(. So before you give it to your parents, you change it, in o...

1 year ago

Solved

Simple Matrix

Make the following matrix without typing it in one by one. [1 2 3; 2 4 6; 4 8 12] x=[1 2 3].

1 year ago

Solved

Problem for beginners

Suppose that x is a column vector, with at least a length of 6. Delete the 2., 6., and the second last row. Example: X=[1;2;3...

1 year ago

Solved

Problem for beginners

M is a nxm matrix. Swap the fist and the second last column with eachother. X=[1 2 3;4 5 6;7 8 9] Y=[2 1 3;5 4 6;8 7 9]

1 year ago

Solved

Stairs

Make an n by n matrix, where the elements are ones and zeros. In the main diagonal, and under that, there should be only ones (...

1 year ago

Solved

Square root

Given x (a matrix), give back another matrix, where all the elements are the square roots of x's elements.

1 year ago

Solved

Create a random vector of integers with given sum

Your task today is to write a function that returns a vector of integer numbers, between, and including, 1 and m, of which the s...

1 year ago

Solved

Guess the number I'm thinking of

In this game you are competing against two other people to guess the number that I'm thinking of. # I randomly choose an *i...

1 year ago

Solved

Generate a random matrix A of (1,-1)

Input n: is an positive integer which serves as the dimension of the matrix A; Output: A=(Aij),where each entry Aij is either...

1 year ago

Solved

Given n, create n random numbers such that their standard deviation is also n.

Given n, create n random numbers such that their standard deviation is also n.

1 year ago

Solved

Project Euler: Problem 9, Pythagorean numbers

A Pythagorean triplet is a set of three natural numbers, a b c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 =...

1 year ago