Solved

Reshape a Vector

Write a function that accept three inputs. The first one is a row vector S. The second and third arguments are m and n which de...

3 månader ago

Solved

average for three points

how to calculate the average (for each three values of y) y=[2 3 5 3 4 2 3 4 5 3 2 7 8 6 5 5 4 3 3 3 2 ] you ...

3 månader ago

Solved

Calculate the height of an object dropped from the sky

Assume that an object is dropped from 1000 meters above the surface of the earth at time t=0. The object is dropped such that t...

3 månader ago

Solved

Return fibonacci sequence do not use loop and condition version 2

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

3 månader ago

Solved

Sum of elements of a vector (★★★)

Given any vector x = [x1, x2, x3, ... xn], compute the sum of its elements. Thus, if x = [ 1 3 -2 5 ], then the sum of its el...

3 månader ago

Solved

Matrix convolution

A certain convolution step involves an elementwise multipication between two 3x3 matrices and taking the resulting sum of the el...

3 månader ago

Solved

Create logarithmically spaced values (★)

Given three numbers a,b,n with b>a, create a vector y with n logarithmic spaced values between 10^a and 10^b. Thus, if a = -2, ...

3 månader ago

Solved

Element-wise vector product (★)

Given two vectors x and y, compute their element-wise product z. Thus, if x = [1 3 5] and y = [0.5 -1 2], then z = [1*0.5...

3 månader ago

Solved

*Prime number check 2 (in construction)

Another way to see if a number is prime is to count the number of factors. For example, the number 4 has 2 factors, [ 2 4 ]...

3 månader ago

Solved

Make a checkerboard matrix (★★★★★)

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

3 månader ago

Solved

Vector raised to a power, element-wise (★)

Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then ...

3 månader ago

Solved

Create a vector with n repeated values of a number x (★★)

If x=3 and n=7 then the vector y would be y=[3 3 3 3 3 3 3]

3 månader ago

Solved

Stacking vectors into a matrix

Given a 4x1 vector a, and a 2x2 matrix b, create a matrix M in which the first 2 rows are each identical to a and the last two r...

3 månader ago

Solved

Median computation (★★★)

See easy edition of this problem. However, now you must compute the median of any real-valued vector without using the in-built...

3 månader ago

Solved

Median computation (★)

Given a vector of values, compute the median. The median is defined as the middle value in a set of *sorted* data. Thus, if ...

3 månader ago

Solved

Fill a zeros matrix (★★★★★)

(Copy of Problem 830) The aim is to fill an array of all zeros given a numerical value and the index of row and columns for t...

3 månader ago

Solved

Average of corner elements of a matrix (★★)

(copy of prob 2235) Calculate the average of corner elements of a matrix. e.g. x=[1 2 3; 4 5 6; 7 8 9;] avg = (1+3+7+9)...

3 månader ago

Solved

Sum of terms in a series 1 (★★★)

Given x and n, compute the following sum: |x|+|x|^(1/2)+|x|^(1/3)+|x|^(1/4)+|x|^(1/5) ... + |x|^(1/n) where ||x|| indica...

3 månader ago

Solved

Generate n equally spaced "intervals" between -x and x (★)

Given n and x, return a list of numbers (in ascending order) that divides the interval [-x x] into n equal-length intervals. ...

3 månader ago

Solved

Create a vector of the first n natural numbers (★)

If n = 7, your program should return a vector y, where y = [1 2 3 4 5 6 7].

3 månader ago

Solved

Prime number check (★★)

One way to see if a number x is prime is to compute the remainders obtained when dividing x by all integers from 2 to √(x). If x...

3 månader ago

Solved

How to locate the position of an element in a vector without using the find function

(copy of prob 105 with test for find function) Write a function posX = *locatePos* (x,y) which returns the location o...

3 månader ago

Solved

Create a vector of n alternating ones and zeros (★★)

Given n, your output should be a vector y of numbers such that the first number is 1 and the numbers following it alternate betw...

3 månader ago

Solved

Select every other element of a vector (★★)

(copy of prob 6) Write a function which returns every other element of the vector passed in. That is, it returns the all odd-...

3 månader ago

Solved

Matrix Indexing

Given a matrix A and scalars r,c,i, find the product of two elements, with the first element located at row r and column c (doub...

3 månader ago

Solved

Sum of elements in a vector (★)

(copy of Prob. 3) Find the sum of all the numbers of the input vector x. Input x = [1 2 3 5] Output y is 11 <> ...

3 månader ago

Solved

Vector creation using colon operator

Create a vector y containing n uniformly spaced values between a and b, with a < b. Use the colon (:) operator.

3 månader ago

Solved

Get the elements of diagonal and antidiagonal for any m-by-n matrix (★★★★)

(copy of prob. 859) In this problem you must submit a solution which returns the diagonal and anti-diagonal elements without ...

3 månader ago