84 total contributions since 2019

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

11 months ago

Solved

Find the largest number

Given a vector v with 4 elements, find the largest number x. Example: Input: v = [4 7 1 6]; Output: x = 7; You mu...

11 months ago

Solved

Matlab Basics - Pick out parts of a vector

Consider x a vector of length >= 7 (there are at least 7 elements in the vector, write a script that extracts the 2nd element, a...

11 months ago

Solved

Side of an equilateral triangle

If an equilateral triangle has area A, then what is the length of each of its sides, x? <<http://upload.wikimedia.org/wikipe...

11 months ago

Solved

Do Fast Fourier Transformation

Example Fast Fourier Transformation from vector [2,1]) ans = 3 1

11 months ago

Solved

Test if two numbers have the same digits

Given two integers _x1_ and _x2_, return |true| if the numbers written with no leading zeros contain the same digits. That is, t...

11 months ago

Solved

Matlab Basics II - Intervals

Write a function that takes an interval from a to b, and divides it into 5 parts example: a = 1, b = 2 output = 1 1.25 ...

11 months ago

Solved

Sum of the Multiplication of Vectors

Given the vectors x and y as input, multiply the vectors and return the summation of its elements. Example: x = [1 2 ...

11 months ago

Solved

matrix of natural number

Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 resides seially as shown in the examples below. ...

11 months ago

Solved

Bit Reversal

Given an unsigned integer _x_, convert it to binary with _n_ bits, reverse the order of the bits, and convert it back to an inte...

11 months ago

Solved

Sum the 'edge' values of a matrix

Sum the 'edge' values of an input matrix (the values along the perimeter). Example [1 2 3 4 5 6 7 8 9] Output = ...

11 months ago

Solved

Speed of car

Calculate the Speed of car given its Distance travelled and time taken in x and y respectively

11 months ago

Solved

Matlab Basics II - Count rows in a matrix

Write a function that returns that number of rows in a vector or matrix x example: x = [1; 2; 3] output = 3

11 months ago

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

11 months ago

Solved

BASICS - sum part of vector

Please make a function, where as input you get vector "x" and and vector "c", where in "c" vector you get indexes to sum. Examp...

11 months ago

Solved

Returning a "greater than" vector

Given a vector, v, return a new vector , vNew, containing only values > n. For example: v=[1 2 3 4 5 6] n=3 vNew =...

11 months ago

Solved

Cumulative product of a vector

Cumulative product of a vector example x=[1 2 5 10], then answer must be [ 1 2 10 100] *If you like this prob...

11 months ago

Solved

Square Diagonal

If n is the given number, then make a diagonal matrix of size 2*2 with the square of that number.

11 months ago

Solved

Find the product of a Vector

How would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?; x = [1 : 0.5 : 6]; y ...

11 months ago

Solved

Summation of array

Given an array, Find the sum of all of the elements in it Examples: Input x = [1 2 3 5; 4 5 6 7]; Output y is 33

11 months ago

Solved

Square the input

Given a scalar or vector x, return the square of each element. Example x = [7 2] answer = [49 4]

11 months ago

Solved

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

11 months ago

Solved

Find out value of sine given by degree.

Find out value of sine given by degree. If theta=30, it's value must be 0.5.

11 months ago

Solved

Solve the set of simultaneous linear equations

Given this pair of simultaneous linear equations: 2x + 3y = 23 3x + 4y = 32 Find the solution set (x,y)

11 months ago

Solved

Relative ratio of "1" in binary number

Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

11 months ago