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...
6年弱 前
解決済み
Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody.
Given an input matrix, generate an output matrix that consists o...
Matlab Basics - Pick out parts of a vector
Consider x a vector of length >= 7 (there are at least 7 elements in the vector, write a script that extracts the 2nd element, a...
6年弱 前
解決済み
Vector creation
Create a vector using square brackets going from 1 to the given value x in steps on 1.
Hint: use increment.
6年弱 前
解決済み
Sum of diagonal of a square matrix
If
x = [1 2 4; 3 4 5; 5 6 7]
then y should be the sum of the diagonals of the matrix
y = 1 + 4 + 7 = 12
6年弱 前
解決済み
Create a vector
Create a vector from 0 to n by intervals of 2.
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...
6年弱 前
解決済み
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
6年弱 前
解決済み
04 - Scalar Equations 2
Define the variables a and b:
<<http://samle.dk/STTBDP/Assignment1_4-a.png>>
<<http://samle.dk/STTBDP/Assignment1_4-b.png>...
6年弱 前
解決済み
Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.
6年弱 前
解決済み
Find max
Find the maximum value of a given vector or matrix.
Divide by 4
Given the variable x as your input, divide it by four and put the result in y.
6年弱 前
解決済み
Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B.
So if
A = [1 2 3;
4 5 6];
...
6年弱 前
解決済み
Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...
6年弱 前
解決済み
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.
6年弱 前
解決済み
Matlab Basics II - Minimum
Write a function that returns the minimum of each ROW of a matrix x
example: x = [1 2 3; 4 5 6];
output [1;4];
6年弱 前
解決済み
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...
6年弱 前
解決済み
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....
6年弱 前
解決済み
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...
6年弱 前
解決済み
Reverse the vector
Reverse the vector elements.
Example:
Input x = [1,2,3,4,5,6,7,8,9]
Output y = [9,8,7,6,5,4,3,2,1]