Faculty member in civil & environmental engineering

Solved

Sum 1 to 100 even number

Write a Matlab program to add all the even numbers from 0 to 100 |

10 hours ago

Solved

Mo money, mo math 1! (★★★)

(adapted from Prob 9 Cody team) You have a vector where the elements represent the number of $20 bills, $10 bills, $5 bills, ...

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

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

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

2 days ago

Solved

Generate a vector which contains a pyramid pattern (★★★★)

Generate a vector that contains terms that follows a pyramid pattern up to the nth row: 1 2 2 3 3 3 4 4 4 4 ...

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

2 days ago

Solved

Remove the row average (★★★)

(copy of Prob. 963) Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solut...

2 days ago

Solved

Extract leading non-zero digit (★★★★★)

(Copy of Problem 47) Benford's Law states that the distribution of leading digits is not random. This is probably because man...

2 days 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]

2 days ago

Solved

Create times-tables (★★★)

(copy of prob 33) At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 ti...

2 days ago

Solved

Replicate elements in vectors (★★★)

(copy of Prob 867) Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2...

2 days ago

Solved

Longest run of consecutive numbers (★★★★★)

(copy of Problem 672) Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you...

2 days ago

Solved

PEMDAS test (★★)

Create the function that will return the following expression for x and y. <<https://i.ibb.co/RHWyzrv/Code-Cogs-Eqn-1.gif>> ...

2 days ago

Solved

Magnitude of a vector (★★★)

Given a vector x with values [ x1, x2, x3, ..., xn ], compute the magnitude (or length) of the vector which is given by <<htt...

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

2 days ago

Solved

Matrix indexing with two vectors of indices (★★)

(copy of Prob 589) Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)). Thus, if...

3 days ago

Solved

Union of two set decreasing order

Union of two set decreasing order Say, x=[1 2 5] and y=[5 7 8] then answer must be [8 7 5 2 1]

3 days ago

Solved

create a square matrix

create a [n*n] matrix. example: mat(4)= [ 1 4 9 16 4 4 9 16 9 9 ...

3 days ago

Solved

Times 5

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

3 days ago

Solved

Add a row of zeros on top of a matrix

Given a matrix, insert a row of zeros as the top row.

3 days ago

Solved

Vector with a repeated entry

Create a row vector of length n, filled with 4's. For example, if n = 3, output = [4 4 4] Hint: Search for the function...

3 days 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 days 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 days ago

Solved

Mo money, mo math #2! (★★★)

(adapted from Prob 9 Cody team) You have a matrix for which each row is a person and the columns represent the number of quar...

3 days ago

Solved

Approximate functions 1 (★★★)

Compute the following sum for any given x and positive integer n. <<https://i.imgur.com/eUwXdSE.gif>> <> Here m! denote...

3 days 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 days ago