Answered

How to find all the possible feasible solutions to a integer linear programme?

For R^20, yes. Just do an exhaustive search, [x{1:20}]=ndgrid([0,1]); x=reshape( cat(21,x{:}) ,[],20).'; feasible = x(:, al...

How to find all the possible feasible solutions to a integer linear programme?

For R^20, yes. Just do an exhaustive search, [x{1:20}]=ndgrid([0,1]); x=reshape( cat(21,x{:}) ,[],20).'; feasible = x(:, al...

4 dagar ago | 0

| accepted

Answered

Optimization of Rosenbrock function

fun = @(x)100*(x(:,2) - x(:,1).^2).^2 + (1 - x(:,1)).^2 - 108.32; [x,fval]=lsqnonlin(fun,[0,0],[1,1])

Optimization of Rosenbrock function

fun = @(x)100*(x(:,2) - x(:,1).^2).^2 + (1 - x(:,1)).^2 - 108.32; [x,fval]=lsqnonlin(fun,[0,0],[1,1])

4 dagar ago | 0

Answered

Basic question of convolution

But, when the equation is y[n] = x[n-1] * h[n+1], how can I make n-1 and n+1?? There is no need to in this case. because of the...

Basic question of convolution

But, when the equation is y[n] = x[n-1] * h[n+1], how can I make n-1 and n+1?? There is no need to in this case. because of the...

4 dagar ago | 1

| accepted

Answered

3D best fit curve from x,y and z data points

For the linear case, you can use linear3dFit from this FEX submission. As the others have said, however, we need to know the spe...

3D best fit curve from x,y and z data points

For the linear case, you can use linear3dFit from this FEX submission. As the others have said, however, we need to know the spe...

5 dagar ago | 0

| accepted

Answered

How to merge two table coulmns into one column?

T1=table([1;2;3],'VariableNames',{'X'}); T2=table([3;6;7],'VariableNames',{'X'}); x=str2double(string(T1.X)+string(T2.X))

How to merge two table coulmns into one column?

T1=table([1;2;3],'VariableNames',{'X'}); T2=table([3;6;7],'VariableNames',{'X'}); x=str2double(string(T1.X)+string(T2.X))

5 dagar ago | 1

| accepted

Answered

Select image region using point coordinates

regions=regionprops(yourImage,'PixelList'); detector=@(s) ismember([x,y], s.PixelList,'rows'); find( arrayfun( detector , ...

Select image region using point coordinates

regions=regionprops(yourImage,'PixelList'); detector=@(s) ismember([x,y], s.PixelList,'rows'); find( arrayfun( detector , ...

5 dagar ago | 1

Answered

Determining internal coordinates of a rotated ellipsoid

Why is triangulation part of the strategy if you want actual points inside the ellipsoid? If you have the means to sample the su...

Determining internal coordinates of a rotated ellipsoid

Why is triangulation part of the strategy if you want actual points inside the ellipsoid? If you have the means to sample the su...

5 dagar ago | 0

Answered

Quadprog solver stalled, constraints satisfied.

Well, because in the first case you are using a non-default ConstraintTolerance, of course. That changes the conditions when the...

Quadprog solver stalled, constraints satisfied.

Well, because in the first case you are using a non-default ConstraintTolerance, of course. That changes the conditions when the...

5 dagar ago | 0

| accepted

Answered

How to download polyparci file and run it with matlab code becsause there iss no polyparci command in-built of MATLAB

This might be it: https://www.mathworks.com/matlabcentral/fileexchange/39126-polyparci?s_tid=srchtitle

How to download polyparci file and run it with matlab code becsause there iss no polyparci command in-built of MATLAB

This might be it: https://www.mathworks.com/matlabcentral/fileexchange/39126-polyparci?s_tid=srchtitle

5 dagar ago | 0

Answered

How to do Interpolation for paired images.?

This might help, https://www.mathworks.com/matlabcentral/fileexchange/22665-n-dimensional-fourier-interpolation

How to do Interpolation for paired images.?

This might help, https://www.mathworks.com/matlabcentral/fileexchange/22665-n-dimensional-fourier-interpolation

5 dagar ago | 0

Answered

Plotting a logical function if a value is greater than 0

Something like this? tor=1:10; AG=tor>5; y=double(AG); y(~AG)=nan; h=plot(tor,y); xlim([min(tor),max(tor)]);xlabel 'tor',...

Plotting a logical function if a value is greater than 0

Something like this? tor=1:10; AG=tor>5; y=double(AG); y(~AG)=nan; h=plot(tor,y); xlim([min(tor),max(tor)]);xlabel 'tor',...

6 dagar ago | 0

Answered

Implicit plane curve discretization

fp=fimplicit(@(x,y) x.^2 + 2*y.^2 - 1); %Example Points=[fp.XData;fp.YData]

Implicit plane curve discretization

fp=fimplicit(@(x,y) x.^2 + 2*y.^2 - 1); %Example Points=[fp.XData;fp.YData]

6 dagar ago | 3

| accepted

Answered

Selecting a block of values in a matrix.

Loops are not needed. Using sepblockfun (which you must Download) yourMatrix=randi(100,10); %example result=repelem(sepblock...

Selecting a block of values in a matrix.

Loops are not needed. Using sepblockfun (which you must Download) yourMatrix=randi(100,10); %example result=repelem(sepblock...

6 dagar ago | 0

Answered

How to draw 2D object with plot 3D matlab

The command cylinder() will be helpful. This example in particular, https://www.mathworks.com/help/matlab/ref/cylinder.html#mw_...

How to draw 2D object with plot 3D matlab

The command cylinder() will be helpful. This example in particular, https://www.mathworks.com/help/matlab/ref/cylinder.html#mw_...

6 dagar ago | 1

| accepted

Answered

How to add uniform noise to image with median and standard deviation

I've never heard of "noise" with non-zero mean/median, but generating it is straightforward, delta=standardDeviation*sqrt(12); ...

How to add uniform noise to image with median and standard deviation

I've never heard of "noise" with non-zero mean/median, but generating it is straightforward, delta=standardDeviation*sqrt(12); ...

6 dagar ago | 0

| accepted

Answered

How to Check if a cell equals a word in a table

As an example, x=cell2table({'dog','paper','cat','fish','paper'}.') paper=nnz( string(x{:,1})=="paper") otherstuff=size...

How to Check if a cell equals a word in a table

As an example, x=cell2table({'dog','paper','cat','fish','paper'}.') paper=nnz( string(x{:,1})=="paper") otherstuff=size...

6 dagar ago | 0

Answered

Nested structs and objects - do or don't?

Ultimately, it depends on the situation and the data access patterns that you are going to need. As a rule of thumb, I don't thi...

Nested structs and objects - do or don't?

Ultimately, it depends on the situation and the data access patterns that you are going to need. As a rule of thumb, I don't thi...

6 dagar ago | 1

| accepted

Answered

How to call columns of matrices using 'for loop' ?

for i=1:3 Approx{i}= U(:,1:i)*S(1:i,1:i)*V(:,1:i).'; end

How to call columns of matrices using 'for loop' ?

for i=1:3 Approx{i}= U(:,1:i)*S(1:i,1:i)*V(:,1:i).'; end

6 dagar ago | 0

| accepted

Answered

How to modify selected rows of one variable in table

fun=@(c) interp1(IzeroAugInCell(:,1),IzeroAugInCell(:,2), c); ListNexafs.uhvI0(tmpMatch) = cellfun(fun, ListNexafs.xRayEkin_e...

How to modify selected rows of one variable in table

fun=@(c) interp1(IzeroAugInCell(:,1),IzeroAugInCell(:,2), c); ListNexafs.uhvI0(tmpMatch) = cellfun(fun, ListNexafs.xRayEkin_e...

6 dagar ago | 0

| accepted

Answered

How can I delete the rows if they have a NaN value?

keep=~isnan(x); x=x(keep); y=y(keep);

How can I delete the rows if they have a NaN value?

keep=~isnan(x); x=x(keep); y=y(keep);

6 dagar ago | 1

| accepted

Answered

calculating with many different parameters

I want to plot y with 1 value from z, 1 value from a, while showing all result for x = [1 2 3]. To me, this sounds like you ar...

calculating with many different parameters

I want to plot y with 1 value from z, 1 value from a, while showing all result for x = [1 2 3]. To me, this sounds like you ar...

6 dagar ago | 1

Answered

gpu computing and parallel computing (vectorize code)

b=max(0, floor( (1e4-S)/dt) )*dt + S;

gpu computing and parallel computing (vectorize code)

b=max(0, floor( (1e4-S)/dt) )*dt + S;

6 dagar ago | 0

Answered

set extrapolation to connect last point values to the first (extrapolated) ones with interp1

Is this what you want? y = [788.54 827.7 846.66 960.09 136.16 53.991 36.994 904.47 882.32 1417.8 1191.6 154.91]; x = [15 45 74...

set extrapolation to connect last point values to the first (extrapolated) ones with interp1

Is this what you want? y = [788.54 827.7 846.66 960.09 136.16 53.991 36.994 904.47 882.32 1417.8 1191.6 154.91]; x = [15 45 74...

7 dagar ago | 0

| accepted

Answered

FZERO error with matrix dimensions

You can trap the occurrence of the error using dbstop if caught error

FZERO error with matrix dimensions

You can trap the occurrence of the error using dbstop if caught error

7 dagar ago | 0

| accepted

Answered

separate connected component in two or more regions based on certain criteria

bwareaopen will accomplish item (1) straightforwardly. Other than that, since you haven't committed to a precise separation crit...

separate connected component in two or more regions based on certain criteria

bwareaopen will accomplish item (1) straightforwardly. Other than that, since you haven't committed to a precise separation crit...

7 dagar ago | 1

Answered

How to use splitapply with fitlm

Your regression(y) function takes an argument y that is never used.

How to use splitapply with fitlm

Your regression(y) function takes an argument y that is never used.

7 dagar ago | 0

| accepted

Answered

Plotting a non linear equation.

You could try fimplicit, https://www.mathworks.com/help//matlab/ref/fimplicit.html

Plotting a non linear equation.

You could try fimplicit, https://www.mathworks.com/help//matlab/ref/fimplicit.html

7 dagar ago | 1

Answered

Max and Min for every change of integer?

Using your example, data=[1 8 0 1 10 0 1 12 0 2 10 8 2 11 10 2 0 12 3 0 5...

Max and Min for every change of integer?

Using your example, data=[1 8 0 1 10 0 1 12 0 2 10 8 2 11 10 2 0 12 3 0 5...

7 dagar ago | 1

| accepted

Answered

guesses of parameters in fmincon do not satisfy the constraints in nonlcon

Did fmincon report successful convergence? The code you've shown doesn't call fmincon with the exitflag output or show the exit ...

guesses of parameters in fmincon do not satisfy the constraints in nonlcon

Did fmincon report successful convergence? The code you've shown doesn't call fmincon with the exitflag output or show the exit ...

7 dagar ago | 0

| accepted

Answered

Multiple faces merging into a single face when using alphaShape()

If you have R2020b, I think you can just do this: n=9;% The number of sides of the polygon m=0:n-1; rootvec=10*exp(1i*2*pi*m/...

Multiple faces merging into a single face when using alphaShape()

If you have R2020b, I think you can just do this: n=9;% The number of sides of the polygon m=0:n-1; rootvec=10*exp(1i*2*pi*m/...

8 dagar ago | 0

| accepted