A résolu


Generate vector according to sign of vector
Generate vector according to sign of vector Example: If A=[-2 0 5] then output must be[-1 0 1] meaning that for negative n...

environ 7 ans il y a

A résolu


Matlab Basics II - Determine if an array has a 3rd dimension
For an array A, determine whether it has 3 dimensions, return 0 if x is only 2D, and 1 if x is 3D

environ 7 ans il y a

A résolu


Matlab Basics II - Max & Index of Max
Write a function that takes a vector x, then returns both the max value in x and its location in the vector for example x ...

environ 7 ans il y a

A résolu


Replace values under a limit
For a vector x and number n, the goal is to find every element of x inferior to n and replace it by n. Example x= [ 1 2 3...

environ 7 ans il y a

A résolu


find the mean of all elements in a matrix
given a matrix, just find the mean of all elements in the matrix

environ 7 ans il y a

A résolu


Max Change in Consecutive Elements
If an array is given as input then find the index of consecutive elements that represent maximum change. Example: Input ...

environ 7 ans il y a

A résolu


Wheat on a chessboard pt 2
If a chessboard were to have wheat placed upon each square such that x grains were placed on the first square and each successiv...

environ 7 ans il y a

A résolu


intersection of matrices
Given two matrices filled with ones and zeros, determine if they share a common row, column entry. These matrices are of identi...

environ 7 ans il y a

A résolu


We love vectorized solutions. Problem 1 : remove the row average.
Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

environ 7 ans il y a

A résolu


Joining Ranges
You are given a n-by-2 matrix. Each row represents a numeric range, e.g. x = [0 5; 10 3; 20 15; 16 19; 25 25] contains...

environ 7 ans il y a

A résolu


convert between ascii and characters
I have seen multiple problems like this but none of them have a robust test suite associated with them. The first input C is ...

environ 7 ans il y a

A résolu


Return a list sorted by number of consecutive occurrences
Inspired by Problem 38 by Cody Team. Given a vector x, return a vector y of the values in x sorted by the number of CONSECUTIVE...

environ 7 ans il y a

A résolu


Combination of Vectors
Return a combination of vectors x1, x2 based on y1, y2 per: x(j) = 0 if y1(j) < y2(j) x(j) = x1(j) if y1(j)...

environ 7 ans il y a

A résolu


Fermat's Last Theorem - Fermat's conjecture
Fermat's Last Theorem (sometimes called Fermat's conjecture, especially in older texts) states that no three positive integers a...

environ 7 ans il y a

A résolu


Brain Teaser Solver
Write an algorithm to solve this brain teaser: You have a square that is broken into four triangles, the area of three of tho...

environ 7 ans il y a

A résolu


Sort the prime numbers in each row of a 3x3 matrix
Considering a 3x3 matrix A, sort the prime numbers of each row in ascending order. For exemple: input A=[5 8 2 4; ...

environ 7 ans il y a

A résolu


Approximation of Pi
Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

environ 7 ans il y a

A résolu


Approximation of Pi (vector inputs)
Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

environ 7 ans il y a

A résolu


Generate Square Wave
Generate a square wave of desired length, number of complete cycles and duty cycle. Here, duty cycle is defined as the fraction ...

environ 7 ans il y a

A résolu


Mersenne Primes vs. All Primes
A Mersenne prime (M) is a prime number of the form M = 2^p - 1, where p is another prime number. <https://www.mathworks.com/matl...

environ 7 ans il y a

A résolu


arithmetic progression
I've written a program to generate the first few terms of <https://en.wikipedia.org/wiki/Arithmetic_progression arithmetic progr...

environ 7 ans il y a

A résolu


Find similar sequences
Another problem inspired by a question on the <http://www.mathworks.com/matlabcentral/answers answers> forum. Given a matrix ...

environ 7 ans il y a

A résolu


geometric progression
I've modified my <http://uk.mathworks.com/matlabcentral/cody/problems/2800-arithmetic-progression previous program> so that it n...

environ 7 ans il y a

A résolu


Practical 1, Question 2b (incomplete)
See practical_1.pdf, question 2. Currently incomplete!

environ 7 ans il y a

A résolu


Largest Geometric Series
Extension of Ned Gulley's wonderful <http://www.mathworks.com/matlabcentral/cody/problems/317 Problem 317>. In a geometric se...

environ 7 ans il y a

A résolu


Return fibonacci sequence do not use loop and condition
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: ...

environ 7 ans il y a

A résolu


Is the Point in a Triangle?
Check whether a point or multiple points is/are in a triangle with three corners Points = [x, y]; Triangle = [x1, y1; x...

environ 7 ans il y a

A résolu


Closely related?
Given a function past_records() that will report blood sugar level of two twin brothers some random number of days ago. For exam...

environ 7 ans il y a

A résolu


Product of two multidimensional polynomials
MATLAB <https://www.mathworks.com/help/matlab/polynomials.html has a few functions> for creating and manipulating single-variabl...

environ 7 ans il y a

A résolu


Outer product of multiple vectors
In tensor algebra, it is often useful to define a tensor as a product of lower order tensors. Similarly, a multidimensional arra...

environ 7 ans il y a

Charger plus