Generate a NaN...on purpose
The goal is to create a function that will return a single "NaN" without using the nan function. I am interested to see how many...
Distance walked 2D
Suppose you go from x-y coordinates [3,4] to [0,0] to [0,1] to [1,1], then you walked 7 units of distance.
8年弱 前
解決済み
Vectorize the digits of an Integer
Create a vector of length N for an integer of N digits.
x = 123045;
x_vec = [1 2 3 0 4 5];
I happened upon a trick ...
8年弱 前
解決済み
Negative matrix
Change the sign of all elements in given matrix.
8年弱 前
解決済み
07 - Common functions and indexing 2
Define _eMat_:
<<http://samle.dk/STTBDP/Assignment1_3e.png>>
Calculate eMean as the mean across the rows of _eMat_. The an...
8年弱 前
解決済み
06 - Matrix Equations 3
Define the matrices _aMat_, _bMat_, and _cMat_:
<<http://samle.dk/STTBDP/Assignment1_3a.png>>
( _aMat_ = 9x9 matrix full o...
8年弱 前
解決済み
Matlab Basics - Absolute Value
Write a script that returns the absolute value of the elements in x
e.g. x = [-1 -2 -3 -4] --> y = [1 2 3 4]
8年弱 前
解決済み
06 - Matrix Equations 1
Define the vectors _aVec_ and _bVec_ and the matrix _aMat_:
<<http://samle.dk/STTBDP/Assignment1_2a.png>>
and
<<http:/...
8年弱 前
解決済み
Create matrix of replicated elements
Given an input element x, and the dimensions, (m, n) return a matrix of size m x n filled with element x.
Example:
Input: ...
8年弱 前
解決済み
Sorting
Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.
Exa...
8年弱 前
解決済み
Max of a Vector
Write a function to return the max of a vector
8年弱 前
解決済み
Rounding
Round 10.67 and make 'y' equal to that number.
8年弱 前
解決済み
Temperature conversion
Convert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Ke...
Square a Number
Given an input x, return y, which is equal to the square of x.
8年弱 前
解決済み
Deleting an element in a matrix
For vector Grades=[98 56 78 34 100 88 87], delete the number 78 to get the following matrix
Grades=[98 56 34 100 88 87]
**re...
8年弱 前
解決済み
Counting down
Create a vector that counts from 450 to 200 in increments of 10.
8年弱 前
解決済み
What percentage?
Calculate the output c as the percentage of a on b for given a and b.
Reverse a matrix
Its simple. You have to reverse a given matrix.
8年弱 前
解決済み
07 - Common functions and indexing 5
Create the vector _lin_:
<<http://samle.dk/STTBDP/Assignment1_7e.png>>
(the integers from 1 to 20)
Make every other val...
8年弱 前
解決済み
Evaluating a polynomial
Given the following polynomial and the value for x, determine y.
y = 3x^5 – x^3 + 8x – 3
Example
x = 1
y = 3 - 1 +...
8年弱 前
解決済み
Is A the inverse of B?
Given a matrix A and a matrix B, is A the inverse of B?
>>A=[2,4;3,5];
>>B=[-2.5,2;1.5,-1];
>>isInverse...
8年弱 前
解決済み
Distance walked 3D
suppose you go from x-y-z coordinates [3,4,2] to [0,0,2] to [0,1,2] to [1,1,2], to [1,1,20] then you walked 25 units of distance...
8年弱 前
解決済み
05 - Vector Equations 2
Define the vectors _aVec_ and _bVec_:
<<http://samle.dk/STTBDP/Assignment1_2a.png>>
and
<<http://samle.dk/STTBDP/Assig...
8年弱 前
解決済み
05 - Vector Equations 3
Define the vector _dVec_:
<<http://samle.dk/STTBDP/Assignment1_2d.png>>
(Logarithmically spaced numbers between 1 and 10)
...