Perimeter
Given a sequence of points forming a closed path (first and last points are coincident) return the perimeter value.
For example...
約1ヶ月 前
解決済み
Zero Cross
Write a function that counts the number of times n a signal x changes sign.
Examples
x = [1 2 -3 -4 5 6 -7 8 -9 10 11]
...
約1ヶ月 前
解決済み
Multiply Column
Given two input, one matrix and one scalar number
For example
A is a matrix given
A = [ 1 2 2 5 2 5
2 3 4 6...
約1ヶ月 前
解決済み
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...
Rounding off numbers to n decimals
Inspired by a mistake in one of the problems I created, I created this problem where you have to round off a floating point numb...
約1ヶ月 前
解決済み
Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below.
Example
x = [2 3 6 9]
then y should be
[...
約1ヶ月 前
解決済み
Prime number check (★★)
One way to see if a number x is prime is to compute the remainders obtained when dividing x by all integers from 2 to √(x). If x...
約1ヶ月 前
解決済み
Solve the recursion
Solve the recursion: f(n)=f(n-1)+1 + f(n-2)+2.
f(1)=4;
f(2)=8;
約1ヶ月 前
解決済み
Swap two numbers
Example
Input:
a = 10
b = 20
Output
a = 20
b = 10
約1ヶ月 前
解決済み
Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes.
---
Logical indexing works like this.
thresh = 4...
約1ヶ月 前
解決済み
Get the value 100
Knowing that 123-45-67+89=100, write a function that gives this result for any order of the digits in the input. Otherwise, the ...
Frequency Analysis of Text
Frequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of ca...
約1ヶ月 前
解決済み
Namespace
Create a set of n variable names 'a_1',...,'a_n'
The result should be a column oriented cell array of strings.
Example inp...
約1ヶ月 前
解決済み
Get chain of consecutive characters
Write a function that will output a chain of consecutive characters, given 2 letters as input. It has to work backwards too. Exa...
Back to basics 18 - justification
Covering some basic topics I haven't seen elsewhere on Cody.
Given a string with extra spaces in front and/or in back, return...
Calculate the sum of two polynomials
Calculate the sum of two polynomials if they are written in notation with their coefficients.
example:
() + () =
a=[3 4 ...
Solve t^(a*x^2+b*x+c)=s
Solve t^(a*x^2+b*x+c)=s. Return x vector as result.
Example a=1, b=2, c=1, t=3, s=15. Result x(1)= 0.5700 x(2)=-2.5700
H...
約1ヶ月 前
解決済み
Calculate area of sector
A=function(r,seta)
r is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2...
約1ヶ月 前
解決済み
Volume of a Simplex
Return the volume of a <http://en.wikipedia.org/wiki/Simplex regular _n_-simplex> with a unit side length.
Results are up to...
約1ヶ月 前
解決済み
Laws of motion 4
Given the initial velocity 'u', final velocity 'v' and acceleration 'a', find the distance travelled.
約1ヶ月 前
解決済み
Times 2 - START HERE
Try out this test problem first.
Given the variable x as your input, multiply it by two and put the result in y.
Examples:...