解決済み


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

14年以上 前

解決済み


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

14年以上 前

解決済み


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

14年以上 前

解決済み


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

14年以上 前

解決済み


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

14年以上 前

解決済み


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

14年以上 前

解決済み


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

14年以上 前

回答済み
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...

15年弱 前 | 0

送信済み


N-dimensional histogram
Compute n-dimensional histogram

15年弱 前 | ダウンロード 11520 件 |

4.7 / 5

回答済み
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(...

15年以上 前 | 0

回答済み
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...

15年以上 前 | 1

回答済み
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...

15年以上 前 | 0

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

15年以上 前 | 1

回答済み
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')

15年以上 前 | 3

| 採用済み

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

15年以上 前 | 0

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

15年以上 前 | 6

回答済み
d-column combinations of matrix A n by n
Another way is: any(A,2)

15年以上 前 | 1

| 採用済み

回答済み
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))

15年以上 前 | 0

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

15年以上 前 | 2

| 採用済み

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

15年以上 前 | 1

回答済み
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)); ...

15年以上 前 | 0

回答済み
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...

15年以上 前 | 0

回答済み
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...

15年以上 前 | 1

回答済み
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>

15年以上 前 | 0

| 採用済み

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

15年以上 前 | 3

回答済み
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...

15年以上 前 | 1

回答済み
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...

15年以上 前 | 0

| 採用済み

回答済み
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...

15年以上 前 | 1

回答済み
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...

15年以上 前 | 0

| 採用済み

回答済み
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 ...

15年以上 前 | 1

さらに読み込む