Median computation (★)
Given a vector of values, compute the median. The median is defined as the middle value in a set of *sorted* data. Thus, if
...
5年弱 前
解決済み
Mo money, mo math 1! (★★★)
(adapted from Prob 9 Cody team)
You have a vector where the elements represent the number of $20 bills, $10 bills, $5 bills, ...
Function 1 (★)
Compute the value of
<<https://i.imgur.com/AxKWLmE.gif>>
for any given positive x.
5年弱 前
解決済み
Make a checkerboard matrix (★★★★★)
(copy of Prob. 4)
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1...
5年弱 前
解決済み
Doubling elements in a vector (★★)
(copy of prob. 1024)
Given the vector A, return B in which all numbers in A are doubling. So for:
A = [ 1 5 8 ]
t...
Swap the first and last columns (★★)
(copy of Prob 19)
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becom...
5年弱 前
解決済み
Select every other element of a vector (★★)
(copy of prob 6)
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-...
5年弱 前
解決済み
Triangle Numbers (★★)
(copy of problem 5)
Triangle numbers are the sums of successive integers. So 6 is a triangle number because
6 = 1 + 2 + 3...
Sum of elements in a vector (★)
(copy of Prob. 3)
Find the sum of all the numbers of the input vector x.
Input x = [1 2 3 5]
Output y is 11
<>
...
5年弱 前
解決済み
Vector raised to a power, element-wise (★)
Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then
...
5年弱 前
解決済み
Element-wise vector product (★)
Given two vectors x and y, compute their element-wise product z.
Thus, if x = [1 3 5] and y = [0.5 -1 2], then
z = [1*0.5...
5年弱 前
解決済み
Create logarithmically spaced values (★)
Given three numbers a,b,n with b>a, create a vector y with n logarithmic spaced values between 10^a and 10^b.
Thus, if a = -2, ...
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...