統計
All
Feeds
解決済み
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...
約8年 前
問題
Maximum of ND-array
Find the maximum element of a N dimensional array. Example: A=[1 2 4 ; -20 4 10]; The maximum is 10.
約8年 前 | 1 | 65 個のソルバー
解決済み
Convert a vector to a lower triangular matrix
I now have a row vector and I want to convert it to a lower trilangular matrix. The rows of the lower trilangular matrix have...
約8年 前
解決済み
Simple polynomial evaluation
Compute the value of a polynomial of degree n with all coefficients '1', at value x. n is always n>=0. p(x)=1+x+x^2+...+x^n...
約8年 前
問題
Sum of digits of 2^n number
Given n, find the *cumulative* sum of the digits of the number 2^n (where n>=0). Example: Input n = 7 Output sum = 2 ...
約8年 前 | 0 | 30 個のソルバー
解決済み
Bottles of beer
Given an input number representing the number of bottles of beer on the wall, output how many are left if you take one down and ...
約8年 前
解決済み
Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...
約8年 前
解決済み
Which values occur exactly three times?
Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...
約8年 前
解決済み
Circle area using pi
Given a circle's radius, compute the circle's area. Use the built-in mathematical constant pi.
約8年 前
解決済み
Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]
約8年 前
解決済み
Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.
約8年 前
解決済み
Numbers with prime factors 2, 3 and 5.
Make a function which takes one positive integer n and returns a matrix with the numbers of the form (2^i)*(3^j)*(5^k) which are...
13年弱 前
問題
Numbers with prime factors 2, 3 and 5.
Make a function which takes one positive integer n and returns a matrix with the numbers of the form (2^i)*(3^j)*(5^k) which are...
13年弱 前 | 4 | 475 個のソルバー
解決済み
First N Perfect Squares
*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];
13年弱 前
解決済み
Cannon Ball
Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.
13年弱 前
解決済み
Tell me the slope
Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];
13年弱 前
解決済み
Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...
13年弱 前
解決済み
Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...
13年弱 前
解決済み
Pascal's Triangle
Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...
13年弱 前
解決済み
Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...
13年弱 前
解決済み
Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...
13年弱 前
解決済み
Target sorting
Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...
13年弱 前
解決済み
Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...
13年弱 前
解決済み
Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...
13年弱 前
解決済み
The Goldbach Conjecture, Part 2
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...
13年弱 前
解決済み
Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...
13年弱 前
解決済み
Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...
13年弱 前