Solved

Numbers spiral diagonals (Part 1)

Inspired by Project Euler n°28 et 58. A n x n spiral matrix is obtained by starting with the number 1 and moving to the right...

oltre 4 anni ago

Solved

The Matrix Construction

Given two input ,first one is CN (Column Number), Second one is Dim Can you produce such a matrix for example CN=6; Dim=2 ...

oltre 4 anni ago

Solved

Generate this matrix

For a given odd integer n, generate a matrix as follows: Input: n = 5; Output: [ 2 1 0 0 0 1 ...

oltre 4 anni 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 ...

oltre 4 anni ago

Solved

Matrix to vector transformation

given a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in des...

oltre 4 anni ago

Solved

Basics - not so easy division

Please make a function whcih divides x/y, but pay attention for some exceptions with NaN,0,Inf. Sometimes return "ERROR" instead...

oltre 4 anni ago

Solved

Make one vector from two others

You are given two vectors of equal length. Your task is to create a MATLAB script that will repeat all of the values in the fir...

oltre 4 anni ago

Solved

Find the last digit

FInd the last digit of a given number. Given number is the input and output should be the last digit of that number.

oltre 4 anni ago

Solved

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

oltre 4 anni ago

Solved

Tax Calculator

Calculate the tax for a given income. 10% tax is paid for any income up to $2,000. 20% tax is paid for additional income u...

oltre 4 anni 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...

oltre 4 anni ago

Solved

Create a magic square matrix for a given odd integer

A magic square of size 'N' is a matrix that satisfies the following criterias: # Dimension - NxN # Matrix should contain ALL...

oltre 4 anni ago

Solved

How many Integers?

Count the integers in a given vector |v|. You *must* use a loop to count each element separately. Examples: Input: v...

oltre 4 anni 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...

oltre 4 anni ago

Solved

The twelve days of Christmas

Traditionally there are twelve days of Christmas to celebrate ("Twelvetide"), typically starting with Christmas Day (25 December...

oltre 4 anni 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 ...

oltre 4 anni 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 ...

oltre 4 anni ago

Solved

I hope to lose weight healthily...

In order to reduce weight healthily, weight will be reduced by 4% every month. Please calculate how many months it will take...

oltre 4 anni ago

Solved

Add 3 (x<=100) Or Subtract 100 and add 3(100<x)

Add 3 to every element. However, if the value is greater than 100, subtract 100 and add 3. eg. input x = [45 106; 67 1...

oltre 4 anni ago

Solved

Product of Each Column

Given a matrix |mat| with |n| columns, return a row vector |v| of length |n|, where every element in |v| is the product of the |...

oltre 4 anni ago

Solved

Let's make puddings !

We will make puddings with eggs, milk and sugar. To make one pudding, we need one egg, 140(cc) of milk, 15 (g) of sugar. Now W...

oltre 4 anni ago

Solved

Jack's hand in "Titanic" ♤

Given a series of cards, return true if it's the famous hand. Note that i pretend that poker cards goes from 1 to 10 so be care...

oltre 4 anni ago

Solved

Remove the first, third and fifth rows of a matrix

Given a matrix x with at least five rows, return a matrix y that includes all rows of x except for th 1st, the 3rd and 5th. E...

oltre 4 anni ago

Solved

Problem 44444 !!! free beer everyone

just say hallelujah to solve this problem

oltre 4 anni ago

Solved

Eye Squared

For a positive integer |n| create the identity matrix with |n| elements. In case it is not possible to produce an identity ma...

oltre 4 anni 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 ...

oltre 4 anni ago

Solved

distance to a straight line (2D) given any 2 distinct points on this straight line

Given 2 points P1,P2 on a straight line and a 3rd point, determine the distance of the 3rd point to the straight line. Your answ...

oltre 4 anni ago

Solved

Parallel vectors

Return true or false depending on whether 2 vectors are parallel or not. Vectors can be 2 or 3 dimensional. The origin is not c...

oltre 4 anni ago