Temperature conversion
Convert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Ke...
Television Screen Dimensions
Given a width to height ratio of a TV screen given as _w_ and _h_ as well as the diagonal length of the television _l_, return t...
約1年 前
解決済み
Square the input
Given a scalar or vector x, return the square of each element.
Example
x = [7 2]
answer = [49 4]
約1年 前
解決済み
Find the largest number
Find the largest number |x| among 4 numbers given as variables |a|, |b|, |c|, and |d|.
Example:
Input: a = 4; b = 7; c ...
約1年 前
解決済み
square root
Find the square root (y) of an input (x).
Square a Number
Given an input x, return y, which is equal to the square of x.
約1年 前
解決済み
Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal.
Example:
>> M=magic(5);
>> flipDiagonal(M)
9 24 1 ...
約1年 前
解決済み
Try 1.5.4: Celsius to Fahrenheit
Write a program to convert an input given in Celsius to Fahrenheit.
Examples:
Input celsiusValue = 100
Output fahrValu...
約1年 前
解決済み
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
...
約1年 前
解決済み
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
[...
約1年 前
解決済み
Draw 'O' !
Given n as input, generate a n-by-n matrix 'O' using 0 and 1 .
example:
n=4
ans=
[1 1 1 1
1 0 0 1
...
約1年 前
解決済み
Draw a 'Z'.
Given _n_ as input, generate a n-by-n matrix like 'Z' by _0_ and _1_ .
Example:
n=5
ans=
[1 1 1 1 1
0 0 0 1 ...
約1年 前
解決済み
Multiply a column by a row
* Given a column vector C and and a row vector R.
* Output a matrix M.
* Every column of M equals to C multiplied by correspon...
約1年 前
解決済み
frame of the matrix
Given the matrix M, return M without the external frame.
First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero i...