2D sliding/moving/running average window
Just some hint if your want to implement efficiently using loop : To do mean, you might do sliding sum onf the data, then divid...

8 días ago | 0

| accepted

I = rand(128,256); n = 16; mat2cell(I, n*ones(1,size(I,1)/n), n*ones(1,size(I,2)/n))

8 días ago | 0

| accepted

How can I create a Delanay point in a cube?
A cube can be devided in 6 tetrahedra nx=4; ny=3; nz=2; grid = arrayfun(@(n)linspace(0,n,n+1),[nx,ny,nz], 'unif', 0); [gr...

9 días ago | 0

| accepted

How do I put my values in certain bins and retrieve the values from the highest count bin
Adapt this to your need % Example data A=rand(2,3,20); A(randi(numel(A),1,10))=0; [m,n,p] = size(A); edges = 0:0.1:1; A(...

10 días ago | 1

| accepted

How to generate all possible permutations of an array having numbers from 1 to 24?
perms(1:4) % toy example perms(1:24) % what you ask is Why? Because you need (factorial(24)*24*8)/(1024^4) =~ 10^14 Tera b...

10 días ago | 1

Finding the max number of non-zero repeating elements for each row in a large matrix
This code would not requires too much RAM beside a copy of A transposed. It somesort of vectorized runlength encoding. A little...

10 días ago | 2

Is it possible to have an ode solver solve in chronological order?
@Isabella "Also looking at the ode45 documentation, I do see that it solves using the previous timestep, so I'm now looking into...

10 días ago | 1

How to specify breaks for spline fitting?
It seems I iedit again a wrong post that is not mine ! Sorry that happens for people who is distracted like me, probably age is ...

10 días ago | 0

How to find out TSP of a graph.
Have you tried this https://www.mathworks.com/help/optim/ug/travelling-salesman-problem.html

11 días ago | 0

Update doesn't work, is uninstall and reinstall too risky?
May be the safest is to download the full installation (with update 3) locally, then install it if you are willing to take the r...

12 días ago | 1

| accepted

Could anyone please explain why MATLAB doesn't return answer to this code?
Walter is correct, you should break the interval and do integration on each sequentially clc, clear % Inputs: g0 = 1.62; ...

12 días ago | 0

How to find inverse of filter such that product of filter and its inverse results in a flat spectrum
If you are working if IIR filter faminy then the answer is trivial yes, since the inverse of the franfert function if a fraction...

13 días ago | 0

Find out whether a 2D line (y = a*x + b) intersects with a square without using "solve" (I need something faster)
This shoudl do: % example line parameters: a = 1.61; b = -3.1; % example square parameters: x_min = 7.5; x_max = 8.5; ...

13 días ago | 3

Improve speed of linear interpolation in nested loops
This seems to work clear clc close all nx = 40; % grid size for x nb = 45; % grid size for b nk = 55; b_min = -1...

13 días ago | 2

| accepted

Find value of signal A at a given value of signal B (twice for every cycle)?
You can fit a model to the interpolated data to remove the jump due to interval leap ab=load('file1.txt'); a=ab(:,1); b=ab(...

14 días ago | 0

how to modify the variables for changing FOR loop to PARFOR loop??
Could you try this inner loop (EDIT fix issue with 0 label): final_lmatrix = 0; parfor n = 1:new_regions region = (L==n);...

14 días ago | 0

To generate a series with n numbers on and n numbers off
n=4; x=reshape(n+(0:10)*2*n+(0:n-1)',1,[])

14 días ago | 0

integral function gives the wrong answer
The function need to be "vectorized", i.e. able to work on an input that is a vector when using with integral I = integral(@(X)...

14 días ago | 1

I'm trying to convert a 1 dimension lat,lon,data to 2d data without interpolating (without griddata command). Is this possible?
T = readtable('chiranjit Das DAY_1.xlsx'); A = table2array(T); lat=A(:,1); lon=A(:,2); data=A(:,3); longrid = -180:180;...

16 días ago | 1

what the time span do in ode45?
No, it means exactly what in the doc says "tspan — Interval of integration vector Interval of integration, specified as a vec...

16 días ago | 1

finding the orthogonal vectors for a series of vectors
A direct method for vectors in R^3 a=rand(100,3); % but be non zeros % Generate b and c orthogonal to a a2 = a(:,[2 3 1]); ...

16 días ago | 1

finding the orthogonal vectors for a series of vectors
If you have recent MATLAB (from 2021b) % Invent some test data xhat = rand(10,3); [B,~,~]=pagesvd(reshape(xhat',3,1,[])); ...

16 días ago | 3

Speed improvement of repeated cross-correlation of an "almost same area" ?
Shift by 1 can be decomposed rotate by 1, follow by add the first/last element by the new entry - the value of other side So...

18 días ago | 0

Sort values in a cell array
Another method B=[8,1,8,3]; A=[90,45,38,51]; [Bs,i]=sort(B); mat2cell(A(i),1,diff(find([true,diff(Bs)>0,true]))) % or mor...

18 días ago | 0

How to match pair of two elements of a matrix with the pair of two elements of another matrix?
A= [1 3; 5 9; 7 6; 10 8] B = [10 8; 7 6; 70 16; 1 3; 12 34; 5 9; 20 45; 10 8] [tf,loc] = ismember(B,A,'rows'); rowindexInA = ...

18 días ago | 0

| accepted

extract control points of curve with spline
Calm down, if you have 1D data, this FEX function provides to compule the spline with reduced knots to approximate the data. Th...

18 días ago | 0

Parfor loops indexing into table rows
This works, but I'm not sure is what you want. IMO table is not well-suited data structure to do calculation. Simple raw numeri...

19 días ago | 0

Why MATLAB coder is crashing while generating trial code with an assertion failed message.
IMO the assertion fault is not the cause but an indicator that you passed the data that are not of the size/class of what the co...

19 días ago | 1

How to reshape the three dimensional array in 2D matrix?
A = reshape(pagetranspose(val),[],size(val,3))

19 días ago | 1

| accepted