Gelöst


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

26 Tage vor

Gelöst


Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

26 Tage vor

Gelöst


only input
Return the output without writing any code into the function.

26 Tage vor

Gelöst


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

26 Tage vor

Gelöst


Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

26 Tage vor

Gelöst


Matlab Basics II - squares
Write a function that takes matrix A, and squares each element in the matrix example: A = [1 2 3] output = [1 4 9]

26 Tage vor

Gelöst


Matlab Basics - Set unwanted parts of a vector to zero
Consider a vector x, of length >= 7, write a script to set elements 2, 5, and 6 to zero. Example x = [1 2 3 4 5 6 7] --> ...

26 Tage vor

Gelöst


Create incrementing array
Given a and b generate an output matrix as shown in following examples: a=2 b=5 output=[2 20 200 2000 20000] a=4 b...

26 Tage vor

Gelöst


Create a square matrix of multiples
Given an input, N, output a matrix N x N with each row containing multiples of the first element of each row. This also applies...

26 Tage vor

Gelöst


Calculate distance travelled when given radius and rotations
When given radius of wheel and number of rotations calculate total distance travelled consider pi=3.14

26 Tage vor

Gelöst


convert matrix to single column
given any matrix, convert it to single column

26 Tage vor

Gelöst


Reverse Run-Length Encoder
Given a "counting sequence" vector x, construct the original sequence y. A counting sequence is formed by "counting" the entrie...

26 Tage vor

Gelöst


Matrix with different incremental runs
Given a vector of positive integers a = [ 3 2 4 ]; create the matrix where the *i* th column contains the vector *1:a(i)...

26 Tage vor

Gelöst


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

26 Tage vor

Gelöst


Find out sum and carry of Binary adder
Find out sum and carry of a binary adder if previous carry is given with two bits (x and y) for addition. Examples Previo...

26 Tage vor

Gelöst


Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

26 Tage vor

Gelöst


Sum of series V
What is the sum of the following sequence: Σk(k+1) for k=1...n for different n?

26 Tage vor

Gelöst


Which doors are open?
There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

26 Tage vor

Gelöst


Sum of series II
What is the sum of the following sequence: Σ(2k-1)^2 for k=1...n for different n?

26 Tage vor

Gelöst


Find the longest sequence of 1's in a binary sequence.
Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

26 Tage vor

Gelöst


Sum of series VI
What is the sum of the following sequence: Σk⋅k! for k=1...n for different n?

26 Tage vor

Gelöst


Given a matrix, swap the 2nd & 3rd columns
If a = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; then the result is ans = 1 3 2 4 1 3 2...

26 Tage vor

Gelöst


Maximum running product for a string of numbers
Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Spe...

26 Tage vor

Gelöst


kmph to mps
convert kilometer per hour to meter per second

26 Tage vor

Gelöst


Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

26 Tage vor

Gelöst


Renaming a field in a structure array
MATLAB has a <http://www.mathworks.com/help/techdoc/ref/setfield.html setfield> and a <http://www.mathworks.com/help/techdoc/ref...

26 Tage vor

Gelöst


Find the next prime number
Find the next prime number or numbers for given n. For example: n = 1; out = 2; or n = [5 7]; out = [7 11]; ...

26 Tage vor

Gelöst


Dimensions of a rectangle
The longer side of a rectangle is three times the length of the shorter side. If the length of the diagonal is x, find the width...

26 Tage vor

Gelöst


Rotate a Matrix by 90 degrees
Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...

26 Tage vor

Gelöst


Height of a right-angled triangle
Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...

26 Tage vor

Mehr laden