Solved

Factorial !

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

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

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

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

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

6 months ago

Solved

Fibonacci Decomposition

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

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

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

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

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

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

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

6 months ago

Solved

Determine the mean of matrix

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

6 months ago

Solved

find nth even fibonacci number

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

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

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

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

6 months 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)...

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

6 months ago

Solved

Rearrange string

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

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

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

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

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

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

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

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

6 months 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+...

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

6 months ago