Answered
how to find common values in two matrix for particular column?
>> sum(A(:,1)+B==2) ans = 1 0 2 1 >>

7 years ago | 1

| accepted

Answered
reduce memory for matrix multiplication
If you are using R2018a/b you can use the MEX file attached here to avoid forming B. The matrix-vector product is replaced by a ...

7 years ago | 0

Answered
Return only the real nullspace of a complex matrix
Torsten proposition: NR = null([real(A);imag(A)]); Torsten is right, it's actually the same null space, and his formula ...

7 years ago | 0

Answered
Return only the real nullspace of a complex matrix
A = randn(2,5)+1i*randn(2,5); % N is a real orthonormal basis of null(A) n = size(A,2); NR=null([[real(...

7 years ago | 0

| accepted

Answered
Is there any code or command for doubling a point ?
% EL parameters a = 148 b = 225 % Group Z/pZ parameter p = 5003 % Point G = [1355,2421]; % Comput...

7 years ago | 1

| accepted

Answered
sub2ind Get values of 3D matrix using an index vector
[m,n,p] = size(A); AR = reshape(A,[m*n, p]); B = AR(sub2ind([m,n],(1:m)',C(:)),:); B = reshape(B,[m 1 p])

7 years ago | 0

| accepted

Answered
Specified number of ones in the matrix
[~,j]=maxk(rand(4),2,1); A = [accumarray([ceil((1:8)'/2),j(:)],1,[4 4]) eye(4)] ans = 1 1 0 0 1 ...

7 years ago | 0

Answered
How to remove items from two arrays that index each other without for loop
You can vectorize LHS as with RHS, the for loop becomes one line mIxPos(mPosIx) = 1:length(mPosIx); That returns the inv...

7 years ago | 1

| accepted

Answered
Can someone explain this large difference in compute time?
Interesting. Just a guess: TRIU and TRIL mark internally the resulting mxArray and MATLAB detects later the specific form and c...

7 years ago | 0

Answered
How to generate B-orthonormal matrix X, which means X'*B*X=I ?
% Assuming B is Hermitian sdp n = length(B); [Q,~] = qr(randn(n)); C = chol(B) X = C\Q % Check X'*B*...

7 years ago | 1

| accepted

Answered
How can I shape a column vector into a matrix?
mat = reshape(mean(ERFF25USshort),[5 5]).'

7 years ago | 0

| accepted

Answered
Is there any code or command for doubling a point ?
I reiterate my answer previously, you need first to program the "+" operator for EL, then doubling point 2*Q is simply Q "+" Q....

7 years ago | 0

Answered
How to convert cells within cells to double.
Just cascading CAT as many as nested level >> c={{[1 2]} {[3 4 5]}} c = 1×2 cell array {1×1 cell...

7 years ago | 0

Answered
Could anyone help me to solve the issue
Strongly recommend using this <https://fr.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum FEX by Rog...

7 years ago | 0

Answered
Could anyone help me to get the sum of an array to a fixed value
Let's be more serious you can do many thing like shifting A = A - sum(A) + 20/size(A,1); or scaling A = 20 * A ./...

7 years ago | 0

Answered
Could anyone help me to get the sum of an array to a fixed value
"There is no fixed logic" OK that's easy then A(:) = 0; A(1) = 20;

7 years ago | 0

Answered
How to pick randomly elements from a vector without repetation?
a(randperm(length(a),2))

7 years ago | 1

| accepted

Answered
FFT of a single sinusoid showing noise ?!
FFT/DFT returns components of the sins/cosine function that are exactly periodic with respect to the number of input data points...

7 years ago | 0

Answered
transforming a 2-dim array integers to 3-dim array of logical which are true for the corresponding number - without using a loop
IND=[4 3 2; 1 2 3]; [I,~,K] = ndgrid(1:size(IND,1),1,1:size(IND,2)); J = IND; GOAL = accumarray([I(:),J(:),K...

7 years ago | 0

| accepted

Answered
How to estimate probabilities of an arbitrary range, based on the probability distribution of a given a data set of numbers?
Use HISTCOUNTS then N = histcounts(x, [-Inf, U, Inf]); P = N(2:end) / sum(N)

7 years ago | 0

| accepted

Answered
How to estimate probabilities of an arbitrary range, based on the probability distribution of a given a data set of numbers?
not sure, is it what you want? x=randi([-2 50],10000,1); U=[-100:100]; h = histogram(x, U);

7 years ago | 0

Answered
Smart detrending for both real noisy signal and pure sinus
"Detrending" just looks like a highpass filter to me. There is no such thing as "smart" xxx (even a lot of people pretent there ...

7 years ago | 1

Answered
Solve 1D Wave Equation (Hyperbolic PDE)
In my book, this equation is a transport equation or convection. It's not an hyperbolic PDE (or wave equation) which is a second...

7 years ago | 0

Answered
Picking arrays from a matrix based on a condition
M=[3 3 3 3 3 2 2 2 4 4; 4 4 4 4 4 2 2 4 4 4; 5 5 5 5 5 2 2 4 4 4; 6 6 6 6 6 2 2 2 4 4] [A,B,C]=deal(M(:,1),M(:...

7 years ago | 1

| accepted

Answered
change the order of array
[~,N] = ismember(M,unique(M(:)))

7 years ago | 0

| accepted

Answered
How to find inverse modulo P of a polynomial A.
Code the <https://en.wikipedia.org/wiki/Polynomial_greatest_common_divisor#Euclidean_division Euclide division algorithm> in Z/p...

7 years ago | 0

Answered
Matrix inverse with qr resolution?
>> A=rand(3) A = 0.7026 0.9489 0.4899 0.7449 0.0949 0.3332 0.5794 0.9151 0.8...

7 years ago | 0

Answered
Repeat combination in matlab loop
A = ceil(10*rand(276,1)) S = sum(reshape(A,12,[]),1)

7 years ago | 0

| accepted

Answered
Create polygons from circles x, y and radii
Your input xc = 1; yc = 2; r = 3; n = 100; Generate polyshape n-points of a circle with center (xc,yc) radius...

7 years ago | 2

| accepted

Load more