Solved

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

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

1 year ago

Solved

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

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

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

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

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

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

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

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

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

1 year ago

Solved

Look Up Mapping

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

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

1 year 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]|. ...

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

1 year 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] ...

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

1 year 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] ...

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

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

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

1 year ago

Solved

Toeplitize a matrix

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

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

1 year ago

Solved

Magnet and Iron

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

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

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

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

1 year 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'...

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

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

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

1 year ago