Solved

Divide by 4

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

2 years ago

Solved

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

2 years ago

Solved

Number of 1s in a binary string

Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

2 years ago

Solved

Maximum value in a matrix

Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

2 years ago

Solved

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

2 years ago

Solved

Who Has the Most Change?

You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

2 years ago

Solved

Determine if input is odd

Given the input n, return true if n is odd or false if n is even.

2 years ago

Solved

Triangle Numbers

Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

2 years ago

Solved

Most nonzero elements in row

Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

2 years ago

Solved

ベクトルの値が増加しているかを調べよう

ベクトルの値が増加している場合 (ベクトルの各要素が前の要素よりも大きい場合) には true を、そうでない場合には false を返すようなコードを書いてみましょう。 例: 入力が x = [-3 0 7] のとき、 関数の...

2 years ago

Solved

Summation of array

Given an array, Find the sum of all of the elements in it Examples: Input x = [1 2 3 5; 4 5 6 7]; Output y is 33

2 years ago

Solved

Y=X

Given an input variable x, output a variable y that is equal in value to x. Example: Input x = 1 Output y is 1 Inp...

2 years ago

Solved

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

2 years ago

Solved

Find out value of sine given by degree.

Find out value of sine given by degree. If theta=30, it's value must be 0.5.

2 years ago

Solved

02 - Vector Variables 1

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_2a.png>>

2 years ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

2 years ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

2 years ago

Solved

Make a random, non-repeating vector.

This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

2 years ago

Solved

Return the first and last character of a string

Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

2 years ago

Solved

Swap the first and last columns

Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

2 years ago

Solved

Find the numeric mean of the prime numbers in a matrix.

There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

2 years ago

Solved

Create times-tables

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

Solved

Find the logic

There exists one logic in between input and output. Find it (easy math). Example 1: x=13 then y=339; Example 2: x=26...

2 years ago

Solved

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

2 years ago

Solved

Matlab Basics - Rounding II

Write a script to round a variable x to 3 decimal places: e.g. x = 2.3456 --> y = 2.346

2 years ago

Solved

ゼロでない要素が一番多い行を探そう

行列 a が与えられたとき、行列 a の中で一番ゼロの要素が少ない行のインデクス r を返す関数を作成しましょう。このとき、行列 a には一つだけしかこの条件に当てはまる行がないと仮定します。 例: 入力として、行列 a = [ 1 ...

2 years ago