Help the Patriots get to the Super Bowl
Given a football by the Patriots, return it to them with 2 psi less air in it.
(The original psi is passed as a number to the...
CARDS PROBLEM
Read my mind and tell me the card number that I have now in my hands.
9年弱 前
解決済み
Circumscribed circles
Given the lengths of the 3 sides of a triangle, output the radius of the circumscribed circle.
Example:
[3 4 5] -> 2.5
9年弱 前
解決済み
Find the nearest integer
Given a vector of integers and a real number find the closest integer.
EX:
>> a = [2 4 5 6 8 10];
>> b = 4.6;
>> nea...
9年弱 前
解決済み
Make a 1 hot vector
Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1.
Example:
Input
...
9年弱 前
解決済み
Create an anti-identity matrix
Create an anti-identity matrix of given dimension.
Examples
n = 2
A = [0 1; 1 0]
n = 3
A = [0 0 1; 0 1 0; 1 0 0...
9年弱 前
解決済み
Check that number is whole number
Check that number is whole number
Say x=15, then answer is 1.
x=15.2 , then answer is 0. <http://en.wikipedia.org/wiki/Whole...
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...
Number of Circles in a Number
Given a number, return the number of closed 'circles' in the base 10 numerical representation.
Note: the number 4 has no circ...
9年弱 前
解決済み
Matlab Basics II - Velocity of a particle
A particle is moving in space, such that it's velocity is given by:
<<http://s30.postimg.org/5rf1xtvj5/cody1.png>>
write a...
Complex number
For complex number c=a+bi, write code that will add a and b together.
9年弱 前
解決済み
Kaprekar numbers
Test if the input is a Kaprekar number: <http://mathworld.wolfram.com/KaprekarNumber.html>. Return a logical true or false.
...
9年弱 前
解決済み
Back to basics 25 - Valid variable names
Covering some basic topics I haven't seen elsewhere on Cody.
Given a string, return true if it is a valid MATLAB variable nam...