Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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]

oltre 5 anni fa

Risolto


Values in Array
How many values are in the array

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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]

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


modulus of a number
find the modulus of a given number

oltre 5 anni fa

Carica altro