Community Profile

# Xusheng Huang

187 2018 年以降の合計貢献数

#### Xusheng Huang's バッジ

Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

4ヶ月 前

Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

6ヶ月 前

De-dupe
Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

6ヶ月 前

Magnitude of a vector
Given a vector x, what is its magnitude?

7ヶ月 前

Find the mean of two vectors
Take two vectors, and output the mean of them (bonus if you don't use the in-built mean function)

7ヶ月 前

Vector Element Multiplication
Take two incoming vectors, and output the element wise multiplication of the vectors.

7ヶ月 前

Weighted average
Compute the weighted average Y, of the vector A, given the weight vector W. The weighted average is the sum of the dot produc...

7ヶ月 前

Powers Of
Fill the vector with powers of 2, so that vector(1) is 2^1, vector(2) is 2^2, etc. Stop with vector(10). Complete the function ...

7ヶ月 前

Create a Standard Size Vector
Given an input x, create a row vector y from 1 to x with 5 elements.

7ヶ月 前

Vector Magnitude Calculator
'a' is a vector that starts at the origin and ends at (x, y). Find ||a||. Hint: It is as simple as "ABC".

7ヶ月 前

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...

7ヶ月 前

Pointwise multiplication of vectors.
Pointwise multiplication of vectors x and y. Example x= [1 3 5 7 9 11 13 15 17 19] y=[ 1 4...

7ヶ月 前

union without repitition
Let a = [9 9 9 9 9 9 8 8 8 8 7 7 7 6 6 6 5 5 4 2 1] b = [1 1 1 3 3 3 3 3 4 4 4 4 4 10 10 10] Output should be [9 8...

7ヶ月 前

Given a Vector v1, create v2 which is the sum of each two adjacent elements in v1. {length(v2)=length(v1)-1}
if v1 is [1 2 3 4 5 6 7 8] then v2 should be [3 5 7 9 11 13 15]. if v1 is [1; 3; 5; 7] the...

7ヶ月 前

Find the product of a Vector
How would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?; x = [1 : 0.5 : 6]; y ...

7ヶ月 前

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

7ヶ月 前

Find the largest number
Given a vector v with 4 elements, find the largest number x. Example: Input: v = [4 7 1 6]; Output: x = 7; You mu...

7ヶ月 前

Change the sign of even index entries of the reversed vector
change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

7ヶ月 前

Sum of adjacent elements in a vector
Given a vector v, return a vector s containting the sum of every two adjacent elements in the vector. Every element s(i) cont...

7ヶ月 前

Angle between two vectors
You have two vectors , determine the angle between these two vectors For example: u = [0 0 1]; v = [1 0 0]; The a...

7ヶ月 前

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...

7ヶ月 前

How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

7ヶ月 前

Rosenbrock's Banana Function and its derivatives
Write a function to return the value of <http://en.wikipedia.org/wiki/Rosenbrock_function Rosenbrock's two-dimensional banana fu...

8ヶ月 前

Get all prime factors
List the prime factors for the input number, in decreasing order. List each factor. If the prime factor occurs twice, list it as...

9ヶ月 前

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 ...

9ヶ月 前

What is the distance from point P(x,y) to the line Ax + By + C = 0?
Given a point, P(x,y), find the distance from this point to a linear line. INPUTS: x, y, A, B, C OUTPUTS: d, the distance ...

9ヶ月 前

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...

9ヶ月 前

Determine the radius of a sphere provided four non-coplanar points on the surface of the sphere. pts = [x1 y1 z1; x...

9ヶ月 前

Are all the three given point in the same line?
In this problem the input is the coordinate of the three points in a XY plane? P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) how can...

9ヶ月 前

Volume of a Parallelepiped
Calculate the volume of a Parallelepiped given the vectors for three edges that meet at one vertex. A cube is a special case ...

9ヶ月 前