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

4年弱 前

Create a vector
Create a vector from 0 to n by intervals of 2.

4年弱 前

Sums of Distinct Powers
You will be given three numbers: base, nstart, and nend. Write a MATLAB script that will compute the sum of a sequence of both ...

5年弱 前

Acid and water
&#9878; &#9878; &#9878; &#9878; &#9878; &#9878; &#9878; &#9878; Assume that there is a 100 liter tank. It is initially fi...

5年弱 前

"Cody" * 5 == "CodyCodyCodyCodyCody"
*Alice*: What? *"Cody" * 5 == "CodyCodyCodyCodyCody"*? You've gotta be kidding me! *Bob*: No, I am serious! Python supports...

5年弱 前

The 5th Root
Write a function to find the 5th root of a number. It sounds easy, but the typical functions are not allowed (see the test su...

5年弱 前

Set a diagonal
Given a matrix M, row vector v of appropriate length, and diagonal index d (where 0 indicates the main diagonal and off-diagonal...

6年弱 前

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

6年弱 前

Sum of the Matrix Elements
Add up all the elements in a NxM matrix where N signifies the number of the rows and M signifies the number of the columns. E...

6年弱 前

Close MATLAB with keyboard
Close MATLAB with keyboard without using mouse

6年弱 前

Number of odd and even elements within matrix
Input(m) - any matrix with integers Output(n) - n(1)=number of odd elements, n(2)=number of even elements Example: * m=...

6年弱 前

Find last zero for each column
Given a numeric array of arbitrary size, return the row index of the last zero for each column. If a column contains all nonzero...

6年弱 前

Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
For a row vector: V=[7 1 2 -3] there is one sign change (from 2 to -3). So, the function you write must return N=1. F...

6年弱 前

Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

6年弱 前

Decimation - Optimized for speed
This problem is similar to http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation, only this time the score will b...

6年弱 前

Unique values without using UNIQUE function
You must return unique values in a vector in *stable* mode without using the unique function. About stable order flag: ...

6年弱 前

Symmetry of vector
Determine whether the vector is symmetric or not (vector could be even or odd in length). For example: x = [1 2 3 3 2 1] ...

6年弱 前

Find nth maximum
Find nth maximum in a vector of integer numbers. Return NaN if no such number exists. x = [2 6 4 9 -10 3 1 5 -10]; So ...

6年弱 前

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

6年弱 前

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

6年弱 前

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

6年弱 前

Joining Ranges
You are given a n-by-2 matrix. Each row represents a numeric range, e.g. x = [0 5; 10 3; 20 15; 16 19; 25 25] contains...

6年弱 前

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

6年弱 前

Construct an index vector from two input vectors in vectorized fashion
Create an index vector defined by two input vectors, one defining the beginnings of one or more index ranges, and the other defi...

6年弱 前

Put two time series onto the same time basis
Use interpolation to align two time series onto the same time vector. This is a problem that comes up in <http://www.mathwork...

6年弱 前

Get the elements of diagonal and antidiagonal for any m-by-n matrix
In the problem <http://www.mathworks.com/matlabcentral/cody/problems/858-permute-diagonal-and-antidiagonal Problem 858. Permute ...

6年弱 前

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

6年弱 前

Generate a Parasitic Number
This problem is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/156-parasitic-numbers Problem 156>. ...

6年弱 前

Fahrenheit to Celsius using multiple statements
°C = (°F - 32) x 5/9 * Write a statement that assigns fractionalMultiplier with 5/9. * Write a second statement that assign...

6年弱 前

Generalised Hamming Number
Inspired by Project Euler n°204 and Problem 1308 by James A generalised Hamming number of type n, has no prime factor larger ...

6年弱 前