Resuelto


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

más de 14 años hace

Resuelto


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

más de 14 años hace

Resuelto


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

más de 14 años hace

Resuelto


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

más de 14 años hace

Resuelto


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

más de 14 años hace

Resuelto


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

más de 14 años hace

Resuelto


Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

más de 14 años hace

Respondida
Puzzler: Quickly tell if two absolute indices (a,b) are four connected for n x m matrix.
function flag = isFourConnected(a,b,n,m) % 10 arithmetic operations by pair c = max(a,b); d = min(a,b); e = c - d...

casi 15 años hace | 0

Enviada


N-dimensional histogram
Compute n-dimensional histogram

casi 15 años hace | 1 descarga |

4.7 / 5

Respondida
Create/deal big binary sparse matrices
m = 80000; n = 10000; p = 0.001; nel = m*n*p; rows = ceil(m*rand(1,nel)); cols = ceil(n*rand(1,nel)); A = sparse(...

más de 15 años hace | 0

Respondida
Defining points of a polygon for use in finding area of triangle.
For polygon (x1,y1) ... (xn,yn) Why not breaking up with respect to the first vertex: T1 = (x1,y1)(x2,y2)(x3,y3) T2 = (x1,y...

más de 15 años hace | 1

Respondida
Create/deal big binary sparse matrices
See my comment above. Instead of A=rand(t,n0)<p; Use sparse directly A = logical(sprand(t, n0, p)); % OR A...

más de 15 años hace | 0

Respondida
Multiply then sum elements of two matrices
I believe sum(A(:).*B(:)) would be faster than dot(...) if that matter.

más de 15 años hace | 1

Respondida
Counting Neighboring Cells
A=[1 0 1 1 0 1 1 0; 1 1 0 1 0 1 1 0] B = ones(3); B(2,2) = 0; conv2(A,B,'same')

más de 15 años hace | 3

| aceptada

Respondida
Multinomial matrix
http://www.mathworks.com/matlabcentral/fileexchange/17818-all-permutations-of-integers-with-sum-criteria K=3 allVL1(K+...

más de 15 años hace | 0

Respondida
Simple Matlab Random Number Generation
To generate true uniform distribution, the correct method is not quite straightforward. I strongly recommend Roger Stafford's FE...

más de 15 años hace | 6

Respondida
d-column combinations of matrix A n by n
Another way is: any(A,2)

más de 15 años hace | 1

| aceptada

Respondida
d-column combinations of matrix A n by n
I'm not ths is what you want: A=rand(10,5)>0.9 % Union of all columns of A logical(sum(A,2))

más de 15 años hace | 0

Respondida
normally random number generator with limited zone
This function will generate a normal distribution conditional by bounds: http://www.mathworks.com/matlabcentral/fileexchange/...

más de 15 años hace | 2

| aceptada

Respondida
Histogram with overlapping bins
You might try this code using my mcolon function: <http://www.mathworks.com/matlabcentral/fileexchange/29854-multiple-colon> ...

más de 15 años hace | 1

Respondida
Search nx3 array row-wise for 2 equal elements
Here is a version that select groups of rows when *at least* two elements are common. % Data A = ceil(100*rand(1000,3)); ...

más de 15 años hace | 0

Respondida
Search nx3 array row-wise for 2 equal elements
I could not remove the two for-loops % Data A = ceil(50*rand(1000,3)); % Engine tic [m n] = size(A); groups = ce...

más de 15 años hace | 0

Respondida
vector to repeated matrix multiplication
v1 = [1 2 3] v2 = [4 5 6] A = [1 2; 3 4] v2(2,:) = -1 P=sum(bsxfun(@times,v1,v2),2) P(1)+P(2)*A % *Not* polyno...

más de 15 años hace | 1

Respondida
Quantify connectivity in a 3D matrix containing ones and zeros representing voids in a microstructure
If you have image processing toolbox, check out this function <http://www.mathworks.com/help/toolbox/images/ref/bwlabeln.html>

más de 15 años hace | 0

| aceptada

Respondida
3D line approximation (spline)
It's called _spline fitting_. Please take a look at File Exchange, such as <http://www.mathworks.com/matlabcentral/fileexchange...

más de 15 años hace | 3

Respondida
Max. distance in a bidimensionnal vector
Here is something I wrote for my own use. The code is to prototype an algorithm which I did in C. S it is not speed optimized, b...

más de 15 años hace | 1

Respondida
Can I speed this code up, looking for similarity between two 3-d matrices.
The trick here is loop on A (small size) and vectorized on B % Test data B=rand(50,60,100); A=rand(2,3,4); %% Engine...

más de 15 años hace | 0

| aceptada

Respondida
Element-wise multiplication where 'elements' are matrices and vectors
Reshape your matrices and vectors to appropriated form for: Matlab sparse matrix approach <http://www.mathworks.com/matlabcentr...

más de 15 años hace | 1

Respondida
griddata (averaging instead of interpolation)
As I understood you have 2D data _r_ depending of _theta_ and _z_ (and not 3D). theta = rand(100000,1)*2*pi; z = rand(10...

más de 15 años hace | 0

| aceptada

Respondida
How to generate a vector with the required values
As Davide wrote, colon() operator will build the array by increment of the step (actually half incremental from both ends), and ...

más de 15 años hace | 1

Cargar más