Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers.
Examples:
[index1 index2] = nearestNumbers([2 5 3...
2年以上 前
解決済み
Flip the vector from right to left
Flip the vector from right to left.
Examples
x=[1:5], then y=[5 4 3 2 1]
x=[1 4 6], then y=[6 4 1];
Request not ...
2年以上 前
解決済み
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...
2年以上 前
解決済み
Dimensions of a rectangle
The longer side of a rectangle is three times the length of the shorter side. If the length of the diagonal is x, find the width...
2年以上 前
解決済み
Back to basics 13 - Input variables
Covering some basic topics I haven't seen elsewhere on Cody.
Return as a string the name of the input variable to the functio...
A matrix of introverts
You are given a matrix full of numbers who happen to be very shy. Write a MATLAB function that will put a square of zeros aroun...
2年以上 前
解決済み
Sum the 'edge' values of a matrix
Sum the 'edge' values of an input matrix (the values along the perimeter).
Example
[1 2 3
4 5 6
7 8 9]
Output = ...
Sum of series I
What is the sum of the following sequence:
Σ(2k-1) for k=1...n
for different n?
2年以上 前
解決済み
The Piggy Bank Problem
Given a cylindrical piggy bank with radius g and height y, return the bank's volume. [ g is first input argument.]
Bonus though...