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

2 mois ago

Solved

Fibonacci-Sum of Squares

Given the Fibonacci sequence defined by the following recursive relation, * F(n) = F(n-1) + F(n-2) * where F(1) = 1 and F(1)...

2 mois ago

Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

2 mois ago

Solved

Extra safe primes

Did you know that the number 5 is the first safe prime? A safe prime is a prime number that can be expressed as 2p+1, where p is...

2 mois ago

Solved

We love vectorized solutions. Problem 1 : remove the row average.

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

2 mois ago

Problem

Rescale Scores

Each column (except last) of matrix |X| contains students' scores in a course assignment or a test. The last column has a weight...

3 mois ago | 0

Problem

Crop an Image

A grayscale image is represented as a matrix in MATLAB. Each matrix element represents a pixel in the image. The element values ...

3 mois ago | 1

Problem

Verify Law of Large Numbers

If a large number of fair N-sided dice are rolled, the average of the rolls is likely to be close to the expected value of a sin...

3 mois ago | 1

Problem

Calculate a Damped Sinusoid

The equation of a damped sinusoid can be written as |y = A.ⅇ^(-λt).cos(2πft)| Given inputs λ ( |lambda...

3 mois ago | 1

Problem

Solve a System of Linear Equations

Given a constant input angle θ(theta) in radians, create the coefficient matrix(A) and constant vector(b) to solve the giv...

3 mois ago | 1

Problem

Plot Damped Sinusoid

Given two vectors |t| and |y|, make a plot containing a blue dashed line of |y| versus |t|. Mark the minimum value |m| of the...

3 mois ago | 1

Solved

Longest run of consecutive numbers

Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

3 mois ago

Solved

Remove the vowels

Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

3 mois ago

Solved

Make a checkerboard matrix

Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Examp...

3 mois ago

Solved

Set the array elements whose value is 13 to 0

Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

3 mois ago

Solved

Breaking Out of the Matrix

Do you want to take the Red Pill, or the Blue Pill? If you take the Blue Pill, you will simply pass along to the next problem...

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

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

4 mois ago

Solved

Plot Line Specifications

Create a line plot for function cos(x) where x is a vector of linearly spaced values going from 0 to input N with an increment o...

5 mois ago

Problem

Plot Line Specifications

Create a line plot for function cos(x) where x is a vector of linearly spaced values going from 0 to input N with an increment o...

5 mois ago | 0

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

5 mois ago

Solved

Vector creation

Create a vector using square brackets going from 1 to the given value x in steps on 1. Hint: use increment.

5 mois ago

Solved

Doubling elements in a vector

Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

5 mois ago

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

5 mois ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

5 mois ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

5 mois ago