Generate a string like abbcccddddeeeee
This is the string version of Problem 1035. <http://www.mathworks.com/matlabcentral/cody/problems/1035-generate-a-vector-like-1-...
5年以上 前
解決済み
vectorization in N
For a given integer n (n>1), compute the sum f (i) (1 <= i <= n) where f (i) = 1 if n is odd and 2 otherwise.
Related Vectors
I have two vectors A & B. If the values in vector A is zero then the corresponding value in vector B should be zero.
Example:...
5年以上 前
解決済み
Cannon Ball
Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.
5年以上 前
解決済み
Phoneword Translator
Given an alphanumeric telephone number (Ex. 1-800-COLLECT), return the purely numeric phone number as a vector. This problem use...
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
[...
5年以上 前
解決済み
Angle between Two Vectors
The dot product relationship, a dot b = | a | | b | cos(theta), can be used to determine the acute angle between vector a and ve...
5年以上 前
解決済み
Geometric series
Find the sum, given the first term t1, the common ratio r, and number of terms n.
Examples
If input t1=1, r=1, n=7 the...
5年以上 前
解決済み
Mode
Find the mode of the vector
Assumption: no vector is bimodal
Example 1: input=[1 2 3 4 4]; output=4
Example 2: input=[7...
Matlab Basics II - Log and natural log
Write a function that calculates the difference between the log and natural log of a vector, to two decimal places
example:
...
Duplicate each element of a vector.
for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice.
Ex...
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 + ...
5年以上 前
解決済み
Is the Point in a Circle?
Check whether a point or multiple points is/are in a circle centered at point (x0, y0) with radius r.
Points = [x, y];
c...
5年以上 前
解決済み
Return unique values without sorting
If the input vector A is [42 1 1],
the output value B must be the unique values [42 1]
The *values of B are in the s...
5年以上 前
解決済み
Triangle???
Calculate the circumference of an equilateral triangle with x