Gelöst


Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

mehr als 12 Jahre vor

Gelöst


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

mehr als 12 Jahre vor

Gelöst


Back to basics 8 - Matrix Diagonals
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

mehr als 12 Jahre vor

Gelöst


Back to basics 6 - Column Vector
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector, output true or false whether it is a colu...

mehr als 12 Jahre vor

Gelöst


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]

mehr als 12 Jahre vor

Gelöst


Factorize THIS, buddy
List the prime factors for the input number, in decreasing order. List each factor only once, even if the factorization includes...

mehr als 12 Jahre vor

Gelöst


Too mean-spirited
Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

mehr als 12 Jahre vor

Gelöst


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

mehr als 12 Jahre vor

Gelöst


Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

mehr als 12 Jahre vor

Gelöst


Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

mehr als 12 Jahre vor

Gelöst


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

mehr als 12 Jahre vor

Gelöst


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

mehr als 12 Jahre vor

Gelöst


Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

mehr als 12 Jahre vor

Gelöst


Add two numbers
Given a and b, return the sum a+b in c.

mehr als 12 Jahre vor

Gelöst


Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

mehr als 12 Jahre vor

Gelöst


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

mehr als 12 Jahre vor

Gelöst


Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

mehr als 12 Jahre vor

Gelöst


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

mehr als 12 Jahre vor

Gelöst


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]; and ...

mehr als 12 Jahre vor

Gelöst


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

mehr als 12 Jahre vor

Frage


Format axes in plot
Is it possible to color a single number (or a set of numbers) on one of the axes in Matlab? Suppose I have a plot: plot(...

mehr als 12 Jahre vor | 1 Antwort | 0

1

Antwort

Frage


Legend in biograph plot
I have a |biograph| object, and I want to "color-code" the edges and vertices. Is it possible to get legends in the biograph...

mehr als 12 Jahre vor | 0 Antworten | 1

0

Antworten

Beantwortet
Mean of 2 arrays
One way would be: mean(mean([imag{1} imag{2}])) If the dimensions don't match: mean([imag{1}(:); imag{2}(:)])

mehr als 12 Jahre vor | 1

Beantwortet
Adding two different size matrices
You can't add matrices of different dimensions. The transpose of A has dimension (50x100) Think of it: A = [1 2 ...

mehr als 12 Jahre vor | 0

| akzeptiert

Frage


Speed up sparse matrix calculations
Is it possible to speed up large sparse matrix calculations by e.g. placing parantheses optimally? What I'm asking is: Can I ...

mehr als 12 Jahre vor | 0 Antworten | 0

0

Antworten

Beantwortet
Explanation of the code
The input to |cosd| and |sind| are in degrees, whereas it is in radians for |cos| and |sin|. l = sind(alpha)*b; % the verti...

mehr als 12 Jahre vor | 1

Frage


Profiling for cells instead of functions
I have a function that in turn calls many more functions. I want to use the profiler to identify what parts of the code is most ...

mehr als 12 Jahre vor | 1 Antwort | 1

1

Antwort

Frage


Finding the difference between columns in matrix without loops
I have the results from an iterative process, where the results from each iteration is placed beside eachother, like this: ...

mehr als 12 Jahre vor | 1 Antwort | 0

1

Antwort

Beantwortet
Not enough input arguments
Use lower case m, or some other letter that can't be mixed with upper case M, as indices in your for-loops, and you'll get there...

mehr als 12 Jahre vor | 0

Beantwortet
Please tell me what's wrong here with the exp (1j*theta)
The reason is that: 5 rad = -1.2832 rad % (-1.2832 + 2*pi = 5) That is: x = x + n*2*pi; % where x is an angle in...

mehr als 12 Jahre vor | 0

| akzeptiert

Mehr laden