Solved

Formatting currency numbers

Given a number, format it properly for textual display using the notation $xxx,xxx,xxx.xx. Assume that no more than two digits ...

7 years ago

Solved

Is the Point in a Triangle?

Check whether a point or multiple points is/are in a triangle with three corners Points = [x, y]; Triangle = [x1, y1; x...

7 years ago

Solved

Duplicate each element of a vector.

for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice. Ex...

7 years ago

Solved

"Low : High - Low : High - Turn around " -- Create a subindices vector

Let two vectors *lo* and *hi* be given. The job is to create a index vector like so idx = [lo(1):hi(1) lo(2):hi(2) ...]...

7 years ago

Solved

Remove from a 2-D matrix all the rows that contain at least one element less than or equal to 4

Example: in = magic(5) in = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 ...

7 years ago

Solved

Return the Nth Output from an Input Command

*Description* Given _F_, a cell array whose first element is a function handle and subsequent elements are arguments, return ...

7 years ago

Solved

ranch area?

Your friend has a ranch with four distinct boundary lines. Three boundary lines are ideal straight roads: (1) North Club Road, (...

7 years ago

Solved

Project Euler: Problem 16, Sums of Digits of Powers of Two

2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^N? Thanks ...

7 years ago

Solved

Find the Kronecker Tensor Product without using KRON

The Kronecker Tensor Product is the result of multiplying all elements of a matrix with each of the elements of another matrix. ...

7 years ago

Solved

Convert String to Morse Code

Convert a given string to international <http://en.wikipedia.org/wiki/Morse_code Morse Code> * Strings will only have [A-z], ...

7 years ago

Solved

Clockwise or Counterclockwise

Given a list of 2-d points defining the vertices of a polygon, determine whether these points are sorted clockwise. The input...

7 years ago

Solved

Volume of a Parallelepiped

Calculate the volume of a Parallelepiped given the vectors for three edges that meet at one vertex. A cube is a special case ...

7 years ago

Solved

Make blocks of color

Given a (Nx3) sequence of RGB colors, I want to create a (numRowBlocks x numColBlocks x 3) image comprising (blockSize x blockSi...

7 years ago

Solved

edge detection

write a function that gives the indexes of rising or falling edge x is a vector (assume it contains always at least one eleme...

7 years ago

Solved

"Look and say" sequence

What's the next number in this sequence? * [0] * [1 0] * [1 1 1 0] * [3 1 1 0] * [1 3 2 1 1 0] This a variant on the w...

7 years ago

Solved

Selecting books on MATLAB for experts and beginners (blindfolded)

* Imagine you have been blindfolded and asked to pick up any two books randomly from the table. * There are n books suitable f...

7 years ago

Solved

exactly?

given two strings of numeric expressions such as '1-7/14' and '11/22+0.2^2', return 1 if they are numerically exactly equal othe...

7 years ago

Solved

Dancing with wolves?

let wolf() make one or two steps to get a feel of the beat, it is waltz, do not let wolf() make the third step, return safely ju...

7 years ago

Solved

drowsy?

This dog() may be drowsy or function immediately when you call, return 1 or 0 accordingly within 2/10 second.

7 years ago

Solved

Maintain shape of logical-index mask

When using logical indexing into an array, MATLAB returns a vector output. For example, if A = magic(3); mask = logi...

7 years ago

Solved

Nonuniform quantizer as a piecewise constant function

Implement a nonuniform quantizer as the following piecewise function: y = -3.5, x < 3 y = -1.5, -3 ≤ x < -1 y = -...

7 years ago

Solved

Remove white space from the string

Remove the white spaces (trailing and leading) from the input variable

7 years ago

Solved

cos for boss?

a programmer had too much coffee and his boss needs cos(alpha+beta) correctly, especially when alpha or beta or the coffee are c...

7 years ago

Solved

Create a dictionary

The goal is to write a function that returns a dictionary from a list of words or phrases and their definitions. Here is an exam...

7 years ago

Solved

Numbers with prime factors 2, 3 and 5.

Make a function which takes one positive integer n and returns a matrix with the numbers of the form (2^i)*(3^j)*(5^k) which are...

7 years ago

Solved

Wilf-Zeilberger pairs

Take as inputs two functions _F_ and _G_, and two scalar values _n_ and _k_. Test whether the functions are candidates to be a W...

7 years ago

Solved

Convert from Base 10 to base 5

Convert the input number from base 10 into base 5: for example: if a(in base 10)= 5 then a(in base 5)= 10

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

7 years ago

Solved

Return the 'Size' of a String of Code

One of the most 'mysterious' parts of playing Cody is the sizing system. Given a string of commands, return the size that Cody w...

7 years ago