Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


Values in Array
How many values are in the array

5 years ago

Solved


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

5 years ago

Solved


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 years ago

Solved


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

5 years ago

Solved


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

5 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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

5 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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 years ago

Solved


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

5 years ago

Solved


modulus of a number
find the modulus of a given number

5 years ago

Load more