Risolto

Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

quasi 8 anni fa

Risolto

Make one big string out of two smaller strings
If you have two small strings, like 'a' and 'b', return them put together like 'ab'. 'a' and 'b' => 'ab' For extra ...

quasi 8 anni fa

Risposto
How do I select specific data?
Hi Charlie, You can index a matrix using the row column indices - matrix dimensions are defined as number of rows x number of...

quasi 8 anni fa | 0

Risolto

Tell me the slope
Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];

quasi 8 anni fa

Risolto

Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

quasi 8 anni fa

Risolto

Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

quasi 8 anni fa

Risolto

Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

quasi 8 anni fa

Risolto

Arrange Vector in descending order
If x=[0,3,4,2,1] then y=[4,3,2,1,0]

quasi 8 anni fa

Risolto

Lightning strike distance: Writing a function
Write a function named LightningDistance that outputs "distance" given input "seconds". Seconds is the time from seeing lightnin...

quasi 8 anni fa

Risolto

Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

quasi 8 anni fa

Risolto

Bottles of beer
Given an input number representing the number of bottles of beer on the wall, output how many are left if you take one down and ...

quasi 8 anni fa

Risolto

Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

quasi 8 anni fa

Risolto

you just measured its surface area, that is the input.

quasi 8 anni fa

Risolto

Create a row array using double colon operator
Create a row array from 9 to 1, using the double colon operator.

quasi 8 anni fa

Risolto

Is this triangle right-angled?
Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

quasi 8 anni fa

Risolto

Length of a short side
Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

quasi 8 anni fa

Risolto

Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

quasi 8 anni fa

Risolto

Pizza value using expression with parentheses
Pizza prices are typically listed by diameter, rather than the more relevant feature of area. Compute a pizza's value (cost per ...

quasi 8 anni fa

Risolto

Fahrenheit to Celsius using multiple statements
Given a Fahrenheit value F, convert to a Celsius value C. While the equation is C = 5/9 * (F - 32), as an exercise use two state...

quasi 8 anni fa

Risolto

How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

quasi 8 anni fa

Risolto

Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

quasi 8 anni fa

Risolto

Weighted average
Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

quasi 8 anni fa

Risolto

Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

quasi 8 anni fa

Risolto

Summing digits
Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...

quasi 8 anni fa

Risolto

Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

quasi 8 anni fa

Risolto

Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

quasi 8 anni fa

Risposto
How to force an external figure in live scripts?
Hi Alex, I've found that you can select the live script in the MATLAB Current Folder view and select F9 to run it as a script...

quasi 8 anni fa | 1

Risolto

The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

quasi 8 anni fa

Risolto

Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Examp...

quasi 8 anni fa

Risolto

Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

quasi 8 anni fa