解決済み


Project Euler: Problem 3, Largest prime factor
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number being input, input might be ui...

5年以上 前

解決済み


Draw a 'N'!
Given n as input, generate a n-by-n matrix 'N' using 0 and 1 . Example: n=5 ans= [1 0 0 0 1 1 1 0 0 1 1 0 ...

5年以上 前

解決済み


Height of a right-angled triangle
Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...

5年以上 前

解決済み


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

5年以上 前

解決済み


Given a matrix A return a vector of the product of the elements in each column using a loop without using prod.
--------------------- for m: 3 1 3 3 10 1 9 1 9 4 1 4 5 6 5 ...

5年以上 前

解決済み


Vector push
Append an element |x| to the end of the vector |v| and return both the extended vector and the new number of its elements. |x| c...

5年以上 前

解決済み


Union of two set decreasing order
Union of two set decreasing order Say, x=[1 2 5] and y=[5 7 8] then answer must be [8 7 5 2 1]

5年以上 前

解決済み


Values in Array
How many values are in the array

5年以上 前

解決済み


prime test 2
enter the only non prime,non composite number

5年以上 前

解決済み


Matrix FUN
Given a Matrix M, find out the number of elements of matrix that are divisible by 3. M = [1 2 3;4 5 6;7 8 9]; ou...

5年以上 前

解決済み


Find the sum of n squares
What is the sum of the squares of the first n integers?

5年以上 前

解決済み


Sum of integers numbers
Sum of the numbers from 1 to 100

5年以上 前

解決済み


Finding an element in a vector
x is a vector of unknown length your function should return the index of the first element in the vector that is greater than...

5年以上 前

解決済み


Vector pop
Take |n| elements from the end of the vector |v| and return both the shorten vector |v| and the |n| elements in a separate vecto...

5年以上 前

解決済み


Approximate the cosine function
Without using MATLAB trigonometric functions, calculate the cosine of an argument |x| to a precision of |0.0001| *Hint:* You ...

5年以上 前

解決済み


Change the first and last diagonal element of the identity matrix to zero
Starting with the identity matrix, change first and last diagonal element to zero. Example If n=5 A = 0 0 ...

5年以上 前

解決済み


Matrix Construction I
Given n, construct a matrix as shown in the example below. Example For n=8, the output should look like this: 1 2 3 4 ...

5年以上 前

解決済み


Diagonal Pattern
For a positive integer |n|, return an |nXn| matrix |mat| such that the value of each element in row |i| and column |j| is given ...

5年以上 前

解決済み


Enlarge array
Given an m-by-n numeric array (A) and a 1-by-2 vector (sz) indicating the dimensions [p q] to enlarge each element, return an (m...

5年以上 前

解決済み


Too Many Zeros, Dump Them!
Sometimes when I create a matrix, I use this syntax: a = zeros(1000,1000); But when the function ends, I find that I don'...

5年以上 前

解決済み


Replace Nonzero Numbers with 1
Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

5年以上 前

解決済み


Sum of series VI
What is the sum of the following sequence: Σk⋅k! for k=1...n for different n?

5年以上 前

解決済み


Given a matrix A (size m x n) create a matrix B (size m+2 x n+2) which consists of matrix A surrounded by zeros. See Example below:
A = [1 2 3 4 5 6] ----------- B = [0 0 0 0 0 0 1 2 3 0 0 4 5 6 0 0 0 0 0 0]

5年以上 前

解決済み


Find the average of a random sequance
Write a function that generates random integers within a loop, and calculates the mean of the positive numbers only. At each ...

5年以上 前

解決済み


Triangle of numbers
Create a matrix with the integers from 1 to |n| arranged in a triangular shape. Every row |i| of the matrix contains |i| inte...

5年以上 前

解決済み


Add a vector to a matrix
Given a matrix |mat| of size |mXn| and a row vector |v| of size |1Xs|, return a matrix with |m+1| rows that conatains |mat| over...

5年以上 前

解決済み


Vertical matrix sort
Given a matrix x with n rows and m columns, return a matrix y with 2n rows and m columns, such that every column in x is sorted ...

5年以上 前

解決済み


Write a function man that takes a row vector v and returns a matrix H as follows..
Write a function called man that takes a row vector v as an input and returns a matrix H whose first column consist of the eleme...

5年以上 前

解決済み


Sum of series III
What is the sum of the following sequence: Σ(2k-1)^3 for k=1...n for different n?

5年以上 前

解決済み


modulus of a number
find the modulus of a given number

5年以上 前

さらに読み込む