Add the even numbers
Add only the even numbers of x
example:
x = [1 2 3 4 5]
the positive numbers are: 2 4, so their sum is 6
3年弱 前
解決済み
Second smallest number
What is the second smallest number in x?
example:
x = [1 2 3 4 5 6 7 8 9]
y = 2
3年弱 前
解決済み
Add the positive numbers
Add only the positive numbers of x
example:
x = [-2 -1 0 1 2 3]
the positive numbers are: 1 2 3, so their sum is 6
3年弱 前
解決済み
Odd times 3
Given a input matrix x, multiply all odd values by 3. Even values remain the same.
example:
x = [1 2 3 4 5;...
6 7...
3年弱 前
解決済み
Odd times even numbers in a matrix
First count the number of odd numbers in x, then the number of even. Return their product.
example:
x = [1 2]
One odd ...
MATLAB Basics: Complex Numbers
For a given complex number, x, return the real and imaginary parts as a vector, y = [Real Imaginary].
3年弱 前
解決済み
Fizz
Dado um número inteiro n, retorne 'fizz' se esse valor for multiplo de 3, ou retorne o valor caso contrario.
Fizz(3) = 'fizz';
...
3年弱 前
解決済み
Divisible by 21
Write a function to determine if a number is divisible by 21.
3年弱 前
解決済み
Find the minimal value in N*N Matrix
Suppose that we have N by N matrix, we try to find the minimal value in that matrix.
examples:
Input A=[1 2 3 5 6;52 58 56 45...
Total resistance of resistors in parallel
What is the total resistance of a number of resistors in parallel?
A vector R contains the resistances (in Ohm) of n resistors,...
3年弱 前
解決済み
Total resistance of resistors in series
What is the total resistance of a number of resistors in series?
A vector R contains the resistances (in Ohm) of n resistors, w...
3年弱 前
解決済み
Replicate and Tile an Array
Replicate and tile an array.
Example
A = [1 2 3; 4 5 6; 7 8 9]
B = Epli_and_Tile(A,1,2)
B = [ 1 2 3 1...
3年弱 前
解決済み
Flipping a Matrix
Flipping matrix up and down.
If a central row is exists, leave it, and flip remaining rows.
Example
Mat = magic(3)
...