A répondu
The fastest way to create a random network?
A = 1*(beta>=rand(n));

plus de 6 ans il y a | 0

| A accepté

A répondu
How to Loop through multiple columns of data
average = mean(sqrt((x2-x1).^2+(y2-y1).^2));

plus de 6 ans il y a | 0

A répondu
Make r a 1x5 vector using rand. Find the elements that have values <0.5 and set those values to 0 (use find).
It is not necessary in Matlab to use 'find' for this problem. Do this: r(r<0.5) = 0; However, if you must use 'find', ...

plus de 6 ans il y a | 0

A répondu
How can I a void this nested loop?
pn = normrnd(M1,repmat(max(P,[],1)-min(P,[],1),2,1)); I'm inclined to doubt that this will save you any significant amoun...

plus de 6 ans il y a | 0

A répondu
Matrix product along one of the dimensions of 3D array
P = prod(T,3);

plus de 6 ans il y a | 2

A répondu
How can I get a matrix B of the indexes in a matrix A that satisfy the following —i representing index— A(i-1)>0 && A(i+1)<0?
B = find(A(1:end-2)>0 & 0>A(3:end)) + 1; Note that the "+1" is necessary here. For example. if A(1)>0 and A(3)<0, we would...

plus de 6 ans il y a | 0

A répondu
How to distribute random points according to the Epanechnikov distribution values
(Correction: I have eliminated the 1) version of the preceding answer, since it was incorrect.) I interpret your 2D Epanechni...

plus de 6 ans il y a | 0

A répondu
Generate random points inside a Epanechnikov distribution
(See my second answer for a much faster method) The following code generates random x values in accordance with the Epanechni...

plus de 6 ans il y a | 0

A répondu
Generate random points inside a Epanechnikov distribution
Courtesy of the internet, I found a much, much faster method of solving the cubic below using the 'sin' and 'asin' functions. ...

plus de 6 ans il y a | 0

A répondu
I want to generate a sequence of n number
n = 3; % <-- Choose any positive integer n t = 1:n; M = [reshape(repmat(t,n,1),[],1),repmat(t',n,1)];

plus de 6 ans il y a | 0

A répondu
How can i multiply each elements of a 16x16 two dimensional matrix with one another to generate 256 values ?
Suppose your 16-by-16 matrix is called M. If you really want to multiply each element of M by all other elements of M, then do ...

plus de 6 ans il y a | 0

A répondu
how to delete a row by selected randomly from a matrix?
This depends on M being exactly equal in each of its elements to the corresponding elements of one of the rows of 'pop': fo...

plus de 6 ans il y a | 0

| A accepté

A répondu
creating a matrix where the element of the second column is smaller than the element of the first column
Here's another way: N = 10; % Choose any integer N (largest number) n = (1:N*(N+1)/2)'; c1 = round(sqrt(2*n-3/4)); ...

plus de 6 ans il y a | 0

A répondu
Finding the inflection point of a sigmoid function
The inflection point occurs at x = p3. You can show it by using the symbolic 'diff' to find the second derivative of f with res...

plus de 6 ans il y a | 1

A répondu
Matrix manipulation using reshape
If the "grouping" is to be randomly determined, do this: n = size(A,1); p = mod((0:n-1)+randi(n-1,1,n),n)+1; % p(k) neve...

plus de 6 ans il y a | 0

A répondu
Sum over a dimension
Bd = diag(B); D = zeros(V,N); for iv = 1:V for in = 1:N D(iv,in) = sum((A(iv,1:K).').*Bd(1:K).*C(1:K,in)); ...

plus de 6 ans il y a | 0

A répondu
Combine two columns into one by first two rows A two rows B and so on
C = reshape([reshape(A,2,[]);reshape(B,2,[])],[],1); This depends on the lengths of the column vectors A and B being the sa...

plus de 6 ans il y a | 0

| A accepté

A répondu
Special selecting rows of a matrix
Let M be the given matrix. Then do this: p = (1:size(M,1)).'; p = p(M(:,10)<=12&M(:,10)>=10); p will be a column vec...

plus de 6 ans il y a | 1

| A accepté

A répondu
how can i represent 3d surface(conical surface) by using surface vector function
You should be using the results of meshgrid to calculate Z so that it will be a matrix, not a vector. As near as I can make out...

plus de 6 ans il y a | 1

| A accepté

A répondu
avoid negative index in array or matrix
Just do this: for i=1:interval_1 j = min(i-1,i2); X(i+1)=c(j+1)*X(i-j); end

plus de 6 ans il y a | 0

| A accepté

A répondu
What would be a Matlab function with two arguments that returns a Matrix (as shown) ?
@Salaijobhaka: I finally managed to write the script I mentioned earlier in the comment above. It produces the same ordering as ...

plus de 6 ans il y a | 1

A répondu
why is contents of array accidentally converted during for loop
If you are referring to the apparent discontinuities in the curves of your plot, you should be aware that the order which 'roots...

plus de 6 ans il y a | 0

| A accepté

A répondu
Help me with this question please....
An alternative formula which reduces the amount of computation would be: n = 99; total = n*(n+1)*(n+2)/3; That is tru...

plus de 6 ans il y a | 0

A répondu
How to add parameters to randi inputs
v = randi(999,15,1); for k = 1:15 if mod(v(k),10) == 9 v = v(1:k); break; end end % Vector v ...

plus de 6 ans il y a | 0

A répondu
Find average of only directly repeating values in array
[~,~,n] = unique(A(:,2)); av = accumarray(n,A(:,1),[],@mean); Note: You should be careful about how the elements in seco...

plus de 6 ans il y a | 0

A répondu
shuffle blocks of elements in vector?
v = reshape(v,[],3); v = reshape(v(randperm(size(v,1)),:),[],1);

plus de 6 ans il y a | 0

A répondu
Error using plot Invalid second data argument
The variable 'Rolla' needs to be the same size as the 1:690 vector. You can check that by writing "size(Rolla)" in your script....

plus de 6 ans il y a | 0

A répondu
Change Bit Value for Some positions
Use the 'xor' function. If one of the arguments is of type uint8 with a single bit equal to 1 and the rest 0, the corresponding...

plus de 6 ans il y a | 0

A répondu
How to get right hand side matrix from left hand side matrix in below image ?
Call the array, M. M = M([10,1,6,3,2],:);

plus de 6 ans il y a | 0

A répondu
Construct a 3D rotation matrix
If your vector to be rotated is v = [bx,by,bz]-[ax,ay,az], the required rotation angle to rotate to w = [0,0,1] ...

plus de 6 ans il y a | 0

| A accepté

Charger plus