A résolu


Matlab Basics - Rounding I
Write a script to round x DOWN to the next lowest integer: e.g. x = 2.3 --> x = 2 also: x = 2.7 --> x = 2

10 mois il y a

A résolu


Matlab Basics - Assigning Variables
Assign different types of data to variables: integer, double, and strings Example: A is a double, for example 2.34 B is a...

10 mois il y a

A résolu


Matlab Basics II - Log and natural log
Write a function that calculates the difference between the log and natural log of a vector, to two decimal places example: ...

10 mois il y a

A résolu


Matlab Basics II - squares
Write a function that takes matrix A, and squares each element in the matrix example: A = [1 2 3] output = [1 4 9]

10 mois il y a

A résolu


Divide by 4
Given the variable x as your input, divide it by 4 and put the result in y.

10 mois il y a

A résolu


Divide by 4
Given the variable x as your input, divide it by four and put the result in y.

10 mois il y a

A résolu


Back to basics 11 - Max Integer
Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive integer MATLAB can handle.

10 mois il y a

A résolu


Relative ratio of "1" in binary number
Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

10 mois il y a

A résolu


Binary code (array)
Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

10 mois il y a

A résolu


Given an unsigned integer x, find the largest y by rearranging the bits in x
Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

10 mois il y a

A résolu


Find the longest sequence of 1's in a binary sequence.
Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

10 mois il y a

A résolu


Area of a circle
Given the radius x, y would be the area of a circle. Pi = 3.1416

10 mois il y a

A résolu


Write a code that will follow the equation y = x * (x + x) * x.
If x = 5, y = 5 * (5+5) * 5 = 250

10 mois il y a

A résolu


Calculate distance travelled when given radius and rotations
When given radius of wheel and number of rotations calculate total distance travelled consider pi=3.14

10 mois il y a

A résolu


Temperature conversion
Convert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Ke...

10 mois il y a

A résolu


Is the input divisible by 3?
Return true if the input is divisible by 3 and false if not.

10 mois il y a

A résolu


Min of a Matrix
Return the minimum value in the given matrix.

10 mois il y a

A résolu


Flip the bit
Given an input character string (e.g. '1001'), return a character string with the bits flipped ('0110').

10 mois il y a

A résolu


Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

10 mois il y a

A résolu


Is my wife right?
Regardless of input, output the string 'yes'.

10 mois il y a

A résolu


Determine the length of a string of characters
Determine the length of a string of characters

10 mois il y a

A résolu


Matrix to column conversion
Given a matrix of any size, convert it into a column vector. e.g A=[10 20 30; 40 50 60] then, B = [10; 40; ...

10 mois il y a

A résolu


Swap two numbers
Example Input: a = 10 b = 20 Output a = 20 b = 10

10 mois il y a

A résolu


Matlab Basics - Convert a row vector to a column vector
Write a script to convert a row (e.g. x = [1 2 3]) to a column (e.g. y = [1;2;3]), your script should be able to do this for any...

10 mois il y a

A résolu


Finding an element in a vector
x is a vector of unknown length your function should return the index of the first element in the vector that is greater than...

10 mois il y a

A résolu


Matlab Basics - y as a function of x
Write a function to calculate y as a function of x, such that y = 6x^2 + 5x - 2

10 mois 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 ...

10 mois il y a

A résolu


Sum the squares of numbers from 1 to n
For a given value of n return the sum of square of numbers from 1 to n. Example For n = 2 then sum of squares = 5 (1^2 + ...

10 mois il y a

A résolu


Beginner's Problem - Squaring
Try out this test problem first. Given the variable x as your input, square it by two and put the result in y. Examples: ...

10 mois il y a

Charger plus