Answered

How can I find indices of an OptimizationExpression array with the value of "Expression with all zero coefficients"?

The function "evaluate" solves the problem. Evaluating the expression at point 1 (or any other point depending on the problem) i...

How can I find indices of an OptimizationExpression array with the value of "Expression with all zero coefficients"?

The function "evaluate" solves the problem. Evaluating the expression at point 1 (or any other point depending on the problem) i...

1 year ago | 0

| accepted

Solved

Acid and water

⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ Assume that there is a 100 liter tank. It is initially fi...

1 year ago

Solved

Fill a zeros matrix

The aim is to fill an array of all zeros given a numerical value and the index of row and columns for this value. 3 Inputs: ...

1 year ago

Solved

Check if number exists in vector

Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

1 year ago

Solved

Getting the indices from a matrice

Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

1 year ago

Solved

Replicate elements in vectors

Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2 3] -> [1 1 2 2 3 3] ...

1 year ago

Solved

Return a list sorted by number of consecutive occurrences

Inspired by Problem 38 by Cody Team. Given a vector x, return a vector y of the values in x sorted by the number of CONSECUTIVE...

1 year ago

Question

How can I find indices of an OptimizationExpression array with the value of "Expression with all zero coefficients"?

Let an optimization expression is given by: expr = optimexpr(5,1); Suppose that only expr(1) and expr(2) are assigned, and we kn...

2 years ago | 1 answer | 0

Solved

Number of Even Elements in Fibonacci Sequence

Find how many even Fibonacci numbers are available in the first d numbers. Consider the following first 14 numbers 1 1 2...

2 years ago

Solved

Create logical matrix with a specific row and column sums

Given two numbers *|n|* and *|s|*, build an |n-by-n| logical matrix (of only zeros and ones), such that both the row sums and th...

2 years ago

Solved

Generate N equally spaced intervals between -L and L

Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

2 years ago

Solved

intersection of matrices

Given two matrices filled with ones and zeros, determine if they share a common row, column entry. These matrices are of identi...

2 years 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 years ago

Solved

Piecewise linear interpolation

Given an Mx2 vector and a row of M-1 integers, output a two column vector that linearly interpolates Y times between each succes...

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

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

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

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

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

2 years ago

Solved

Cryptomath: Addition

W A I T + A L L --------- G I F T S equals: 9 6 0 8 + 6 7 7 --------- 1 0 2 8 5 Given str...

2 years ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

2 years ago

Solved

Convert a vector into a number

This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

2 years ago

Solved

String substitution, sub problem to cryptoMath

This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

2 years ago

Solved

Make a random, non-repeating vector.

This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

2 years ago