Solved

Factorial !

Calculate the factorial of a non-negative integer without using the built in function *factorial*

1 year ago

Solved

Tridiagonal

Return an n-by-n matrix that has a, b, c as the subdiagonal, main diagonal, and superdiagonal entries in the matrix. Example ...

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

1 year ago

Solved

Toeplitz Matrix

For a given square matrix of order n-by-n check whether this is a Toeplitz matrix or not. Return true if it is.

1 year ago

Solved

(Linear) Recurrence Equations - Generalised Fibonacci-like sequences

This problem is inspired by problems <http://uk.mathworks.com/matlabcentral/cody/problems/2187-generalized-fibonacci 2187>, <htt...

1 year ago

Solved

Fibonacci Decomposition

Every positive integer has a unique decomposition into nonconsecutive Fibonacci numbers f1+f2+ ... Given a positive integer n, r...

1 year ago

Solved

How many Fibonacci numbers?

Find the number of unique Fibonacci numbers (don't count repeats) in a vector of positive integers. Example: x = [1 2 3 4...

1 year ago

Solved

Subtract two positive numbers

Given a and b as a string, return b-a without using string to number conversion functions. a and b must to be a same size and b ...

1 year ago

Solved

index of n^2 in magic(n)

input=5 magic matrix 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 ...

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

1 year ago

Solved

Create an n-by-n null matrix and fill with ones certain positions

The positions will be indicated by a z-by-2 matrix. Each row in this z-by-2 matrix will have the row and column in which a 1 has...

1 year ago

Solved

Determine the number of odd integers in a vector

Determine the number of unique odd integers in a vector. Examples: Input x = [2 5 8 3 7 1]; Output y = 4; Inp...

1 year ago

Solved

Determine the mean of matrix

Determine the mean of matrix without using mean function Hint: use simple algorithm

1 year ago

Solved

find nth even fibonacci number

1st even fibonacci number=2 ; 2nd even fibonacci number=8 ..

1 year ago

Solved

generate the matrix

given a value n (say 4) - generate the matrix like below y= [0 1 2 3 4; -1 0 1 2 ...

1 year ago

Solved

Calculating large fibonacci numbers

The fibonacci sequence starts 1,1,2,3,5,8... Find the the n'th fibonacci number. Then calculate round(log10( . )) of that n't...

1 year ago

Solved

Find the sequence

Find the nth number of a sequence. Check the test suite to determine the sequence. * hint: it is closely related to familiar ...

1 year ago

Solved

Fibonacci-Sum of Squares

Given the Fibonacci sequence defined by the following recursive relation, * F(n) = F(n-1) + F(n-2) * where F(1) = 1 and F(1)...

1 year ago

Solved

Find the complement of a number in binary

Input x is a decimal number and output y is the complement of binary representation of x. For example, x = 10 has the binary ...

1 year ago

Solved

Rearrange string

Input is a given string. Output is the number of ways to rearrange the string.

1 year ago

Solved

Cody problems in French : Trouvez la logique Pt.2

Trouvez la logique entre x et y, aidez-vous de la test suite. Bon courage. P.S: L'utilisation de "^" est de nouveau fortement...

1 year ago

Solved

Day counter function

Write a function called _day_counter_ that returns the number of Mondays that fell on the first day of the month in a given year...

1 year ago

Solved

Recursion - Fun

Generate the first k terms in the sequence a(n) define recursively by a(n+1)=p*a(n)+(1+a(n)) with p=0.9 and a(1)=0.5 ...

1 year ago

Solved

Solve equation numerically

y'=y In order to solve equation using computer, numerical analysis are needed. 1st order Euler's method is one of the metho...

1 year ago

Solved

Two dimensional moving average

A=[1 2 3 4 5 1 2 2 2 3 2 3 3 3 4 1 1 4 4 2] B=[1 1;1 1]; % This is can be used for weight factor of moving a...

1 year ago

Solved

Rotate Matrix Both Direction (45 Degree)

*Matrix (3x3 only) rotation*: 3 inputs: *x* matrix, *n* times and *m* option. output: *y* matrix with *n x 45* degree ...

1 year ago

Solved

Scalar Matrix Manipulation

Assume, input x is a scalar matrix such as, x = 2 0 0 0 2 0 0 0 2 th...

1 year ago

Solved

Calculate geostrophic current

eta0=0.01; R=300; f=0.01; g=9.81; x=-500:50:500; y=-500:50:500; [x y]=meshgrid(x,y); eta=eta0*exp(-(x.^2+...

1 year ago

Solved

Find the distance traveled by a car given velocity and time.

A car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and ti...

1 year ago