Solved

Determine if input is odd

Given the input n, return true if n is odd or false if n is even.

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

4 months ago

Solved

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

4 months ago

Solved

Counting Sequence

Given a vector x, find the "counting sequence" y. A counting sequence is formed by "counting" the entries in a given sequence...

4 months ago

Answered

Indexing how many times is an element repeated in a matrix in another array

The following piece of code solve your problem: arr = unique(A); for i=1:length(arr) n = arr(i); B(A==n) = 1:length(...

Indexing how many times is an element repeated in a matrix in another array

The following piece of code solve your problem: arr = unique(A); for i=1:length(arr) n = arr(i); B(A==n) = 1:length(...

4 months ago | 1

| accepted

Solved

Find common elements in matrix rows

Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

4 months ago

Solved

Kaprekar Steps

6174 is the <http://en.wikipedia.org/wiki/6174_%28number%29 Kaprekar constant>. All natural numbers less than 10,000 (except som...

4 months ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

4 months ago

Solved

Find the peak 3n+1 sequence value

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

4 months ago

Solved

Return the 3n+1 sequence for n

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

4 months ago

Solved

Read a column of numbers and interpolate missing data

Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be i...

4 months ago

Answered

Loop for repeating a process multiple times

You need to use the ./ operator to perform division of arrays. Try this E = 100; I = 1:100; C = 1; Loss ...

Loop for repeating a process multiple times

You need to use the ./ operator to perform division of arrays. Try this E = 100; I = 1:100; C = 1; Loss ...

4 months ago | 1

| accepted

Solved

Triangle sequence

A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

4 months ago

Solved

Is this triangle right-angled?

Given any three positive numbers a, b, c, return true if the triangle with sides a, b and c is right-angled. Otherwise, return f...

4 months ago

Solved

Find a Pythagorean triple

Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...

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

4 months ago

Solved

Area of an Isoceles Triangle

An isosceles triangle has equal sides of length x and a base of length y. Find the area, A, of the triangle. <<http://upload...

4 months ago

Solved

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

4 months ago

Solved

Side of a rhombus

If a rhombus has diagonals of length x and x+1, then what is the length of its side, y? <<http://upload.wikimedia.org/wikipe...

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

4 months ago

Solved

Area of an equilateral triangle

Calculate the area of an equilateral triangle of side x. <<http://upload.wikimedia.org/wikipedia/commons/e/e0/Equilateral-tr...

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

4 months ago

Solved

Length of a short side

Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

4 months ago

Answered

i cannot find the minimum values for matrix.

Alternative method to find the minium value for each column: min(T,[],1)

i cannot find the minimum values for matrix.

Alternative method to find the minium value for each column: min(T,[],1)

4 months ago | 0

| accepted

Answered

[U,V]=eig(A) , AU won't equal UV

It is not a bug. It depends of the floating point numbers. If you type the following, you will observe that the floating point...

[U,V]=eig(A) , AU won't equal UV

It is not a bug. It depends of the floating point numbers. If you type the following, you will observe that the floating point...

4 months ago | 1

Solved

Determine if input is a Narcissistic number

<http://en.wikipedia.org/wiki/Narcissistic_number Narcissistic number> is a number that is the sum of its own digits each raised...

4 months ago

Answered

sz means in image segmentation

Let's say you have size = [300 400]. So, img is a matrix of zeros with this size. than you might show. Try the following code: ...

sz means in image segmentation

Let's say you have size = [300 400]. So, img is a matrix of zeros with this size. than you might show. Try the following code: ...

4 months ago | 1

Answered

Unable to perform assignment because the left and right sides have a different number of elements - Gauss-Seidel Method to solve for inverse matrix

For this case, it seems vec has 5x1 size. So you should you sum instead of trace. function [abserr] =errnorm(vec) vec = a...

Unable to perform assignment because the left and right sides have a different number of elements - Gauss-Seidel Method to solve for inverse matrix

For this case, it seems vec has 5x1 size. So you should you sum instead of trace. function [abserr] =errnorm(vec) vec = a...

4 months ago | 1

| accepted

Answered

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side - Jacobi method inverse calculation

Function errnorm(vec) has inconsistent size. Try the following modifications: function [abserr] =errnorm(vec) vec = abs(ve...

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side - Jacobi method inverse calculation

Function errnorm(vec) has inconsistent size. Try the following modifications: function [abserr] =errnorm(vec) vec = abs(ve...

4 months ago | 1

| accepted

Answered

Undefined function 'abs' for input arguments of type 'cell'.

It is saying A is a cell type. In order to check it, run the following code: class(A) If this is the case, the following shoul...

Undefined function 'abs' for input arguments of type 'cell'.

It is saying A is a cell type. In order to check it, run the following code: class(A) If this is the case, the following shoul...

4 months ago | 1

| accepted