Answered

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

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

18 giorni ago | 1

Answered

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

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

18 giorni ago | 2

Answered

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

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

18 giorni ago | 1

Answered

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

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

19 giorni ago | 0

Answered

How to find out TSP of a graph.

Have you tried this https://www.mathworks.com/help/optim/ug/travelling-salesman-problem.html

How to find out TSP of a graph.

Have you tried this https://www.mathworks.com/help/optim/ug/travelling-salesman-problem.html

19 giorni ago | 0

Answered

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

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

20 giorni ago | 1

| accepted

Answered

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

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

20 giorni ago | 0

Answered

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

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

21 giorni ago | 0

Answered

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

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

21 giorni ago | 3

Answered

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

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

22 giorni ago | 2

| accepted

Answered

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

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

22 giorni ago | 0

Answered

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

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

22 giorni ago | 0

Answered

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,[])

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,[])

22 giorni ago | 0

Answered

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

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

22 giorni ago | 1

Answered

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

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

24 giorni ago | 1

Answered

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

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

24 giorni ago | 1

Answered

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]); ...

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]); ...

24 giorni ago | 1

Answered

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,[])); ...

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,[])); ...

24 giorni ago | 3

Answered

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

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

26 giorni ago | 0

Answered

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

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

26 giorni ago | 0

Answered

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

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

26 giorni ago | 0

| accepted

Answered

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

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

27 giorni ago | 0

Answered

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

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

27 giorni ago | 0

Answered

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

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

27 giorni ago | 1

Answered

How to reshape the three dimensional array in 2D matrix?

A = reshape(pagetranspose(val),[],size(val,3))

How to reshape the three dimensional array in 2D matrix?

A = reshape(pagetranspose(val),[],size(val,3))

27 giorni ago | 1

| accepted

Answered

Decimal and very small values returning zeros

Is is more subtle than I though. You should not use 'ArrayValued'==true to evaluate a series of integral. The use case is to in...

Decimal and very small values returning zeros

Is is more subtle than I though. You should not use 'ArrayValued'==true to evaluate a series of integral. The use case is to in...

28 giorni ago | 0

| accepted

Answered

Matlab hidden optimization at the fifth execution

I don't think so. I believe it is related to JIT optimization Executio Engine (EE), some code are not "compiled" at the first fe...

Matlab hidden optimization at the fifth execution

I don't think so. I believe it is related to JIT optimization Executio Engine (EE), some code are not "compiled" at the first fe...

28 giorni ago | 0

| accepted

Answered

Extract Source Code from Compiled App

"Is it possible to extract or reconstruct the Source Code from a compiled app?" The source code is obfuscated, only TMW and co...

Extract Source Code from Compiled App

"Is it possible to extract or reconstruct the Source Code from a compiled app?" The source code is obfuscated, only TMW and co...

28 giorni ago | 1

Answered

How do I display "Busy" like that in MATLAB when simulation is running in GUI?

Create a static text somewhere i the GUI and set the string to "busy" before runing simumation tjen "done" once finished. You c...

How do I display "Busy" like that in MATLAB when simulation is running in GUI?

Create a static text somewhere i the GUI and set the string to "busy" before runing simumation tjen "done" once finished. You c...

28 giorni ago | 0

| accepted

Question

What algorithm pagemldivide uses?

The question starts here from Paul remark that pagemldivide does not return the same numerical solution than backslash "\" appli...

29 giorni ago | 0 answers | 3