Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...
Negative Infinity
Round the given array a towards negative infinity.
9年弱 前
解決済み
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....
9年弱 前
解決済み
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 ...
9年弱 前
解決済み
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]
n=0...
Doubling elements in a vector
Given the vector A, return B in which all numbers in A are doubling. So for:
A = [ 1 5 8 ]
then
B = [ 1 1 5 ...
9年弱 前
解決済み
Counting down
Create a vector that counts from 450 to 200 in increments of 10.
9年弱 前
解決済み
Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...
9年弱 前
解決済み
Flipping
Write code that can reverse the vector without using any sort of loop.
Example
Given the input vector
A = [ 1 2 3 4 5...
9年弱 前
解決済み
Complex number
For complex number c=a+bi, write code that will add a and b together.
Sum the squares of numbers from 1 to n
For a given value of n return the sum of square of numbers from 1 to n.
Example
For n = 2
then sum of squares = 5 (1^2 + ...
Square a Number
Given an input x, return y, which is equal to the square of x.
9年弱 前
解決済み
Create sequnce 1 4 9 16 25.........
Create sequnce 1 4 9 16 25......... upto entered input value using matlab scripting commands. Let y be output and x be input
concatenate the elements
you should concatenate the elements of a matrix in one dimensional array, for example if the input is
A = [1 2 3; 4 5 6; 7 ...
9年弱 前
問題
concatenate the elements
you should concatenate the elements of a matrix in one dimensional array, for example if the input is
A = [1 2 3; 4 5 6; 7 ...
Summing digits
Given n, find the sum of the digits that make up 2^n.
Example:
Input n = 7
Output b = 11
since 2^7 = 128, and 1 + ...
9年弱 前
解決済み
Elapsed Time
Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...
約9年 前
解決済み
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...