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 ...

circa 3 anni 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...

circa 3 anni ago

Solved

middleAsColumn: Return all but first and last element as a column vector
Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

circa 3 anni 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...

circa 3 anni 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 ...

circa 3 anni 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...

circa 3 anni ago

Solved

Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).

circa 3 anni ago

Solved

Specific Element Count
Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_. Note: NaNs are equal and there may be n...

circa 3 anni ago

Solved

Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

circa 3 anni 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...

circa 3 anni ago

Solved

Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

circa 3 anni 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...

circa 3 anni ago

Solved

Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

circa 3 anni ago

Solved

Longest run of consecutive numbers
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

circa 3 anni ago

Solved

Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

circa 3 anni ago

Solved

Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

circa 3 anni ago

Solved

Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

circa 3 anni 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...

circa 3 anni ago

Solved

Target sorting
Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

circa 3 anni ago

Solved

Sums of Distinct Powers
You will be given three numbers: base, nstart, and nend. Write a MATLAB script that will compute the sum of a sequence of both ...

circa 3 anni ago

Solved

The 5th Root
Write a function to find the 5th root of a number. It sounds easy, but the typical functions are not allowed (see the test su...

circa 3 anni ago

Solved

The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

circa 3 anni ago

Solved

Number of Even Elements in Fibonacci Sequence
Find how many even fibonacci numbers are available in the first d numbers. Consider the following first 14 numbers 1 1 2...

circa 3 anni ago

Solved

Predicting life and death of a memory-less light bulb
You have a light bulb that can fail any moment according to the exponential probability distribution. At any moment, the pro...

circa 3 anni ago

Solved

Find the nearest prime number
Happy 5th birthday, Cody! Since 5 is a prime number, let's have some fun looking for other prime numbers. Given a positive in...

circa 3 anni ago

Solved

Write a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty st...

circa 3 anni ago

Solved

Pentagonal Numbers
Your function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascen...

circa 3 anni ago

Solved

Van Eck's Sequence's nth member
Return the Van Eck's Sequence's nth member. For detailed info : <http://oeis.org/A181391 OEIS link> and <https://www.theguard...

circa 3 anni ago

Solved

Inscribed Pentagon?
Your function will be provided with the five vertices of a pentagon (p) as well as the center point (cp) and radius (r) of a cir...

circa 3 anni ago

Solved

Spot the First Occurrence of 5
This problem series invites you to solve two simple problems related to the integer NUMBER FIVE, in order to celebrate <https://...

circa 3 anni ago