Professional Interests: engineering
Top 5% contributor
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...
2 years ago
Generate a vector like 1,2,2,3,3,3,4,4,4,4
So if n = 3, then return
[1 2 2 3 3 3]
And if n = 5, then return
[1 2 2...
you just measured its surface area, that is the input.
If you have two small strings, like 'a' and 'b', return them put together like 'ab'.
'a' and 'b' => 'ab'
For extra ...
Write a two-input, two-output function that swaps its two input arguments. For example:
[q,r] = swap(5,10)
returns q = ...
for certain x-ray radiation, given frequency in petahertz, give wavelength in nanometer, must be accurate +/- 25%
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 ...
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.]
Reverse the vector elements.
Input x = [1,2,3,4,5,6,7,8,9]
Output y = [9,8,7,6,5,4,3,2,1]
Given the number x, y must be the summation of all integers from 1 to 2^x.
For instance if x=2 then y must be 1+2+3+4=10.
Regardless of input, output the string 'yes'.
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...
3 years ago
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...
Given two lists of numbers, determine the weighted average.
[1 2 3] and [10 15 20]
should result in
Given a and b, return the sum a+b in c.
Find the sum of all the numbers of the input vector x.
Input x = [1 2 3 5]
Output y is 11
Input x ...
Try out this test problem first.
Given the variable x as your input, multiply it by two and put the result in y.
Join the conversation