Solved

ベクトル [1 2 3 4 5 6 7 8 9 10] の作成

MATLABでは,角括弧の中に要素を入れることで、ベクトルを作成できる。 x = [1 2 3 4] また次のようにも書ける（コンマはオプション）。 x = [1, 2, 3, 4] 問題：次のベクトルを出力する関数を作成せよ。...

environ un an ago

Solved

2倍してみよう - ここからスタート！

初めにこの問題を試してみよう。 入力としてxを与え、それを2倍して結果をyに代入せよ。 Examples: Input x = 2 Output y is 4 Input x = 17 Output y is 34 ...

environ un an ago

Solved

Find last non-zero in a given dimension

You are given a logical matrix *BW* _of any dimension_, and a dimension *dim*. You need to find the locations of the last non-ze...

environ un an ago

Solved

Find longest run

Write a function longest_run that takes as input an array of 0's and 1's and outputs the length and index of the longest consecu...

environ un an ago

Solved

Assignment Problem

Given a matrix where row i corresponds to person i, and column j corresponds to task j and cell (i,j) corresponds to the time ta...

environ un an ago

Solved

Sorting integers by their digits (Level 3)

This is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level...

environ un an ago

Solved

Sorting integers by their digits (Level 2)

This is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits Probl...

environ un an ago

Solved

Weave two matrices together to form one matrix

Take the first column from matrix a, then insert the first column from matrix b, and so on. For example: a = [1 2 3 4]; b ...

environ un an ago

Solved

Sorting integers by their digits (Level 1)

Given a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done ...

environ un an ago

Solved

Look Up Mapping

Let the input is A = {[] [] [] [1] []}; B = {'A','B','C','D','E'}; Mapped Output = 'D';

environ un an ago

Solved

S-T-R-E-T-C-H I-T O-U-T

You will be given a row of numbers (x), and a single number (n). Your job is to write a script that will stretch out the row of...

environ un an ago

Solved

Check if a rotated array was originally sorted

Suppose a sorted array is rotated at some pivot unknown to you. For example, |[0 1 2 4 5 6 7]| might become |[5 6 7 0 1 2 4]|. ...

environ un an ago

Solved

generate number in particular way

A = [1 5 2 7]; MAX = 10; generate a array Y = [1 2 2 2 2 2 3 3 4 4]; i.e. total eleme...

environ un an ago

Solved

Zero Cross

Write a function that counts the number of times n a signal x changes sign. Examples x = [1 2 -3 -4 5 6 -7 8 -9 10 11] ...

environ un an ago

Solved

Find the sum of the elements in the "second" diagonal

Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

environ un an ago

Solved

MatCAT - Reconstruct X from Its X-rays

Consider a matrix x x = [ 1 2 0 0 5 0 3 0 8 ] If we sum x along the rows we get row_sums = [3 5 11] ...

environ un an ago

Answered

Rank in Matlab shows different result than Mathematica

For example, we have rank=2 in MATLAB and rank=1 in WolframAlpha for a matrix shown below. * Mathematica: <http://www.wolfram...

Rank in Matlab shows different result than Mathematica

For example, we have rank=2 in MATLAB and rank=1 in WolframAlpha for a matrix shown below. * Mathematica: <http://www.wolfram...

environ un an ago | 2

| accepted

Answered

Transpose of a symbolic 'real' results in conj()

You need to use assumeAlso(c, 'real') instead of 'assume' to keep the assumptions on a and b. >> assumptions ...

Transpose of a symbolic 'real' results in conj()

You need to use assumeAlso(c, 'real') instead of 'assume' to keep the assumptions on a and b. >> assumptions ...

environ un an ago | 1

| accepted

Solved

Matrix of Multiplication Facts

This is James's daughter again, sneaking into his Cody account. Thanks to your help in my math class last year, I did great! B...

environ un an ago

Solved

Toeplitize a matrix

Similar to <http://www.mathworks.com/matlabcentral/cody/problems/3094-hankelize-a-matrix Problem 3094. Hankelize a matrix>, now ...

environ un an ago

Solved

Convert matrix to 3D array of triangular matrices

Given a 2D numeric array x in which each column represents the vectorized form of an upper triangular matrix, return a 3D array ...

environ un an ago

Solved

Magnet and Iron

(Inspired from <http://www.mathworks.com/matlabcentral/cody/problems/112 Problem 112: Remove the air bubbles>) Iron (atomic n...

environ un an ago

Solved

Go to the head of the class!

You're given a matrix and a single number. If that number is in the matrix, reorder the matrix so that number is in the first r...

environ un an ago

Solved

Must be in the front row...

You are given a matrix followed by a single number. Your object is to write a script that will shift the matrix around so that ...

environ un an ago

Solved

matrix zigzag

Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

environ un an ago

Solved

Too Many Zeros, Dump Them!

Sometimes when I create a matrix, I use this syntax: a = zeros(1000,1000); But when the function ends, I find that I don'...

environ un an ago

Solved

A matrix of extroverts

Now that the introverts have had their script, the extroverts spoke up (naturally!) and demanded one as well. You will be given...

environ un an ago

Solved

Enlarge array

Given an m-by-n numeric array (A) and a 1-by-2 vector (sz) indicating the dimensions [p q] to enlarge each element, return an (m...

environ un an ago

Solved

Replace Nonzero Numbers with 1

Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

environ un an ago