Community Profile

# Markus Petershofen

Last seen: ungefär 2 månader ago Active since 2016

All

#### Content Feed

View by

Solved

Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

Solved

Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

Solved

Remove the air bubbles
Given a matrix a, return a matrix b in which all the zeros have "bubbled" to the top. That is, any zeros in a given column shoul...

Solved

Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

Solved

Flip the vector from right to left
Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

Solved

Another colon problem
This is simple problem based on problems 555, 801, 1118, etc. Create an index vector from two input vectors. Example: ...

nästan 4 år ago

Solved

Back to basics - mean of corner elements of a matrix
Calculate the mean of corner elements of a matrix. e.g. a=[1 2 3; 4 5 6; 7 8 9;] Mean = (1+3+7+9)/4 = 5

nästan 4 år ago

Submitted

ColorSpill
Color Spill Game

Submitted

Pacman

Submitted

TheLastStand
Object-oriented defense game

Solved

Is this triangle right-angled?
Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

mer än 4 år ago

Solved

Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

mer än 4 år 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...

mer än 4 år 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...

mer än 4 år ago

Solved

Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

mer än 4 år ago

Solved

Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

mer än 4 år ago

Solved

Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

mer än 4 år ago

Solved

Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

mer än 4 år ago

Solved

Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

mer än 4 år ago

Solved

Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

mer än 4 år ago

Submitted

MinesweeperGame
Another Minesweeper Clone

Submitted

RayCasting
Interactive demonstration of raycasting algorithm.

Submitted

geneticAlgoWords
My first attempt at genetic algorithms

Solved

Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

mer än 4 år ago

Solved

Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

mer än 4 år ago

Solved

Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

mer än 4 år ago

Solved

Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

mer än 4 år ago

Solved

Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

mer än 4 år ago

Solved

Multielement indexing of a row array
The row array birthRateChina stores the China birth rate (per 1000 people) for years 2000 to 2012. Write a statement that create...

ungefär 5 år ago

Solved

Create a row array using double colon operator
Create a row array from 9 to 1, using the double colon operator.

ungefär 5 år ago