Answered
Smart detrending for both real noisy signal and pure sinus
<</matlabcentral/answers/uploaded_files/138686/detrend.png>> % Create the X coordinates as 1000 samples from 0 to 100. X...

7 years ago | 1

Answered
Matrix assignment inequality problem
Just shooting in the dark, try replace the problematic instruction with mult(mult == 0) = B(mult == 0);

7 years ago | 0

Answered
How can I change default c++ compiler in MATLAB 2017b ?
It might not correctly detect if you install MSVS on drive other than C:

7 years ago | 0

Answered
finding data in a matrix
Depending on how your data is organized, (you did not tell if x is first index or second) after doing ineedX = find(Xgri...

7 years ago | 0

| accepted

Answered
How can I do this L1 integral minimization?
The problem of linear L1 fit (your case); meaning argmin_x | M*x - y |_l1 argmin sum abs(M*x - y) can be reformulated...

7 years ago | 0

Answered
reshaping matrix with odd number of total elements
You can't

7 years ago | 1

Answered
Area of a closed curve in a complex plane
>> polyarea(real(zeta_w),imag(zeta_w)) ans = 0.0029 >>

7 years ago | 2

| accepted

Answered
Averaging values within bins
load('y.mat') load('x.mat') plot(x,y) edges = (0:5:50); [~,~,loc]=histcounts(x,edges); meany = accumarray(l...

7 years ago | 2

Answered
better than if else conditions
... edges= [0,.6435,.9273,1.1593,1.3694,1.570,1.7722,1.9823,2.2143,2.4981,Inf]; [~,~,tagsPhi] = histcounts(check,edges...

7 years ago | 0

| accepted

Answered
Use MATLAB built-in function conv() to compute and plot y[n]
I don't see what is the difficulty for you. MATLAB array is 1-indexing, and CONV just do the work on array indices. If yo...

7 years ago | 0

| accepted

Answered
random polygons inside a semi-circle
*Edit code*: # make polygon more uniform in size at the trade off of randomness remove artifact of the border. # adjust rep...

7 years ago | 1

| accepted

Answered
could anyone help me to solve the issue
Using this <https://mathworks.com/matlabcentral/fileexchange/24133-set-partition FEX> to illustrate, but you can similarly remov...

7 years ago | 0

| accepted

Answered
How to plot Fourier series with 100 terms ?
for m=1:1:2; And you think this makes 100 terms?? Then bm=(8/m*pi)*(1-cos(m*pi/2)) So you multiply by pi? Look...

7 years ago | 1

| accepted

Answered
dsearchn() Command is slowing down my algorithm, Any better Solution? MATLAB
Replace dsearchn(Data(:,1), Distance2) by interp1(Distance1,Distance2,'nearest'); If you want to get the sa...

7 years ago | 0

| accepted

Answered
Finding multiple minimum number in a column and location
X = [... 100 14 10 4 10 6 101 2 8 8 12 18 102 8 4 8 18 ...

7 years ago | 0

Answered
Help with a rotation matrix
You seem to apply sin/cos to degree angles which is wrong, since argument must be in radian. Also the code is correct and mig...

7 years ago | 2

| accepted

Answered
Specified number of ones in the matrix (column and row)
I couldn't figure out how to generate _k_ permutations that are not redundant beside test and discard until it meets the conditi...

7 years ago | 2

| accepted

Answered
What is the complexity of the permute() fonction for multiway arrays?
The complexity of PERMUTE(A,P) is O(numel(A)) regardless p, but with the constant O depends on p, for example when p=1,2...,d, i...

7 years ago | 0

| accepted

Answered
the 2d convolution result dosen't match my expectation
Not sure what is your expectation, and intention but shooting on the dark, try to replace c = c./max(c); with c = c...

7 years ago | 0

| accepted

Answered
Is there any code or command for doubling a point ?
EL = struct('a', 148, 'b', 225, 'p', 5003); % Point G = [1355,2421]; % Compute C*G for C=1,2,...,maxC maxC...

7 years ago | 1

Answered
How to find the approximation of the solution to an equation with an infinite series?
N = 50; % number of sum t = (1:N); delta = 0.6; R = 2; c = 5; M0 = 2; Rc = R/c; rhs = c/(M0*R); sfun =...

7 years ago | 1

| accepted

Answered
Assign Field to Structure Array without a Loop
For-loop is alright, but if you insist Field1 = [1 2 3]; Field2 = [6 3 1]; % Create struct StructArray = struc...

7 years ago | 1

| accepted

Answered
I have 200 points which are randomly distributed in 16 equal size of grids in 2D & i know the coordinates of the center points. I want to calculate the nearest point of center & also coordinates of those points of each grid.
<</matlabcentral/answers/uploaded_files/138257/nearest.png>> % Generate points x5 = linspace(0,1,4+1); y5 = linspace(...

7 years ago | 1

| accepted

Answered
Indexing structure array. Every first entry of an vector.
If speed is matters, use for-loop s = struct('field1',num2cell(rand(1,100000))); tic a = arrayfun(@(S) S.field1(1...

7 years ago | 1

| accepted

Answered
How to build a matrix of 0, 1 and 2 according to the answers made by individuals of a survey
a = [3,8]; b = [11,15]; c = [9,9]; A=accumarray(a(:),1,[15 1])' B=accumarray(b(:),1,[15 1])' C=accumarray(c...

7 years ago | 1

Answered
Calculate eigenvectors without the function eig
You need to find y, such that |y| = 1 (for example) A*y = lambda*y In otherword y = null(A - lambda*eye(size(A...

7 years ago | 1

Answered
Estimating the derivative by differentiating the interpolating cubic polynomial
% Dummy test data x=cumsum(rand(1,7)); y=rand(size(x)); ppf=spline(x,y); % Derivative ppdf = ppf; pp...

7 years ago | 0

| accepted

Answered
2d matrix of index to get value of 3D matrix
I'm pretty sure I answered something along this line few days ago [m,n,p] = size(A); [I,K] = ndgrid(1:m,1:p); EXTRACT...

7 years ago | 1

Answered
How to describe value changes in constant intervals?
Take a look at this <https://fr.mathworks.com/matlabcentral/answers/421271-2-coupled-second-order-equations old thread>. In my a...

7 years ago | 0

| accepted

Load more