Answered

Random complete and in complete numbers

To randomize uniformly over an interval [lower, upper], you would do, out=rand(___)*(upper-lower)+lower

Random complete and in complete numbers

To randomize uniformly over an interval [lower, upper], you would do, out=rand(___)*(upper-lower)+lower

18 days ago | 0

| accepted

Answered

1D griddedInterpolant of a vector of query points.

One way: rows=1:2; gI= griddedInterpolant({rows,t},f); F=@(t)gI({rows,t}); >> F(3) ans = 0.1411 -0.9897 ...

1D griddedInterpolant of a vector of query points.

One way: rows=1:2; gI= griddedInterpolant({rows,t},f); F=@(t)gI({rows,t}); >> F(3) ans = 0.1411 -0.9897 ...

18 days ago | 0

Submitted

spatialgraph2D

Creates a graph object with 2D spatial locations associated with the nodes

19 days ago | 12 downloads |

Answered

Add Interpolated Vector to Matrix

Z = [150:-1:1]; Nq = zeros(length(ADCP.t)); t=1:0.25:100; clear Ninterp for i=length(t):-1:1 time_in = tStart+...

Add Interpolated Vector to Matrix

Z = [150:-1:1]; Nq = zeros(length(ADCP.t)); t=1:0.25:100; clear Ninterp for i=length(t):-1:1 time_in = tStart+...

19 days ago | 0

| accepted

Answered

Need to solve an singlevariable integral of functions of two variables, and get answers as functions

This function @(t) K_mex_p(t).*CC22(t,J) needs to return a numeric value for every given t. It is returning a symbolic value, ...

Need to solve an singlevariable integral of functions of two variables, and get answers as functions

This function @(t) K_mex_p(t).*CC22(t,J) needs to return a numeric value for every given t. It is returning a symbolic value, ...

20 days ago | 0

Answered

Solving set of 5 non-linear simultaneous equations using fsolve

You should get rid of all the square roots on the unknown parameters. Write the equations in terms of new variables like z1=sqrt...

Solving set of 5 non-linear simultaneous equations using fsolve

You should get rid of all the square roots on the unknown parameters. Write the equations in terms of new variables like z1=sqrt...

21 days ago | 1

Answered

Finding the standard deviation for every single value in a matrix

X=cat(3, X1,X2,X3,X4,X5,X6,X7,X8,X9,X10); %It was a mistake to create 10 separate matrices. MeansX=mean(X,3), StdX = std(X...

Finding the standard deviation for every single value in a matrix

X=cat(3, X1,X2,X3,X4,X5,X6,X7,X8,X9,X10); %It was a mistake to create 10 separate matrices. MeansX=mean(X,3), StdX = std(X...

21 days ago | 0

| accepted

Answered

Solve functions symbolically, and getting answers as functions, solve() fsolve()

C_11_0 = matlabFunction( result.x ) ; C_12_0 = matlabFunction( result.y ) ;

Solve functions symbolically, and getting answers as functions, solve() fsolve()

C_11_0 = matlabFunction( result.x ) ; C_12_0 = matlabFunction( result.y ) ;

21 days ago | 0

Answered

Intlinprog can not find feasible solution even though there is one

This version finds a solution. Basically, I pre-normalize max(Asen(:)) and max(a(:)) to 1 so that the constraint matrix elements...

Intlinprog can not find feasible solution even though there is one

This version finds a solution. Basically, I pre-normalize max(Asen(:)) and max(a(:)) to 1 so that the constraint matrix elements...

22 days ago | 1

Answered

Intlinprog can not find feasible solution even though there is one

Aside from the error mentioned by Mario, the line A = [Atemp, -M*Atemp]; is overwriting your original A matrix (the one cont...

Intlinprog can not find feasible solution even though there is one

Aside from the error mentioned by Mario, the line A = [Atemp, -M*Atemp]; is overwriting your original A matrix (the one cont...

25 days ago | 0

Answered

How to put 2D image in 3D space

This FEX file looks applicable, https://www.mathworks.com/matlabcentral/fileexchange/28581-imsurf-3d-images

How to put 2D image in 3D space

This FEX file looks applicable, https://www.mathworks.com/matlabcentral/fileexchange/28581-imsurf-3d-images

26 days ago | 0

Answered

fmincon constrain a row to be fixed

Yes, you can simply not treat them as unknowns. Instead, rewrite the problem in terms of a smaller matrix z containing the unkno...

fmincon constrain a row to be fixed

Yes, you can simply not treat them as unknowns. Instead, rewrite the problem in terms of a smaller matrix z containing the unkno...

30 days ago | 0

| accepted

Answered

Creating Multiple Arrays within a For Loop

You wouldn't do that with a loop. You would just use vector arithemtic, eps0=rand(3,1); %fake RHS data kappa=rand(3,1); z=ran...

Creating Multiple Arrays within a For Loop

You wouldn't do that with a loop. You would just use vector arithemtic, eps0=rand(3,1); %fake RHS data kappa=rand(3,1); z=ran...

1 month ago | 0

| accepted

Answered

Nonlinear Optimization problem ( If statement)

To do that, each x(i) must have finite upper and lower bounds L(i)<=x(i)<=U(i). You also need to introduce additional unknown b...

Nonlinear Optimization problem ( If statement)

To do that, each x(i) must have finite upper and lower bounds L(i)<=x(i)<=U(i). You also need to introduce additional unknown b...

1 month ago | 0

| accepted

Answered

Most Efficient Way to Construct the Matrices to Extract the Lower and Upper Triangle from a Vectorized Matrix

Another approach to consider is to use my MatrixObj class https://www.mathworks.com/matlabcentral/fileexchange/26611-on-the-fly...

Most Efficient Way to Construct the Matrices to Extract the Lower and Upper Triangle from a Vectorized Matrix

Another approach to consider is to use my MatrixObj class https://www.mathworks.com/matlabcentral/fileexchange/26611-on-the-fly...

1 month ago | 1

Answered

Equality contrains ignored by fmincon

You cannot use the Aeq, beq constraint parameters to force exact equality. You could instead try setting the upper and lower bou...

Equality contrains ignored by fmincon

You cannot use the Aeq, beq constraint parameters to force exact equality. You could instead try setting the upper and lower bou...

1 month ago | 0

Answered

Minimize function with multiple variables with absolute value

If e is positive, rewrite this as a linear program with additional unknowns ,

Minimize function with multiple variables with absolute value

If e is positive, rewrite this as a linear program with additional unknowns ,

1 month ago | 0

Answered

how to generate a random array list with fixed sum ?

This FEX submission would be applicable https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum...

how to generate a random array list with fixed sum ?

This FEX submission would be applicable https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum...

1 month ago | 0

Answered

How to get linprog to not ignore x0 R2019a

If your initial x0 is feasible, one way you might benefit from it is to add the inequality constraint f(:).'*x(:) <= f(:).'*x0 ...

How to get linprog to not ignore x0 R2019a

If your initial x0 is feasible, one way you might benefit from it is to add the inequality constraint f(:).'*x(:) <= f(:).'*x0 ...

1 month ago | 0

Answered

Variable distribution for a parallel image acquisition

Seems like you could use a parfor loop instead: parfor k=1:numel(img_temp) bw_seg_worker{k} = myWatershedFun(img_temp{k},...

Variable distribution for a parallel image acquisition

Seems like you could use a parfor loop instead: parfor k=1:numel(img_temp) bw_seg_worker{k} = myWatershedFun(img_temp{k},...

1 month ago | 0

| accepted

Answered

How can I save my result in a loop when it is an matrix

Should the left hand side be S{i,j,k} ?

How can I save my result in a loop when it is an matrix

Should the left hand side be S{i,j,k} ?

1 month ago | 0

Answered

improve and speed up parfor loop

We can't see all the operations in your loop, but the ones we can see are pretty basic ones. Operations as common and basic as t...

improve and speed up parfor loop

We can't see all the operations in your loop, but the ones we can see are pretty basic ones. Operations as common and basic as t...

1 month ago | 0

Question

Union() operation adds hole to polyshape

I have attached a file containing a vector of 11 polyshape objects >> load('polyshape_vector.mat') >> whos pgon Name ...

1 month ago | 0 answers | 0

Answered

How to access GPU cores to execute parfor loop which has system commands?

I cannot use gpuarray method as there are no major computations done on a single matrix, but the data is passed using a single c...

How to access GPU cores to execute parfor loop which has system commands?

I cannot use gpuarray method as there are no major computations done on a single matrix, but the data is passed using a single c...

1 month ago | 0

Answered

Update a value class property only if required

Is there a reason you don't update when changes to input1 or input2 occur, like in the following? classdef myclass prope...

Update a value class property only if required

Is there a reason you don't update when changes to input1 or input2 occur, like in the following? classdef myclass prope...

1 month ago | 0

Answered

Would like to create a 2x3 matrix using for loop

This line has an error, iFlows=fio2o(i,2); The right hand side fio2o(i,2) is a scalar, but there is no indexing on the left ha...

Would like to create a 2x3 matrix using for loop

This line has an error, iFlows=fio2o(i,2); The right hand side fio2o(i,2) is a scalar, but there is no indexing on the left ha...

1 month ago | 0

| accepted

Answered

Making a function to restructure matrix of coordinates

Z=reshape(xyz(:,3),6,6); %6x6 format and then to revert back, [X,Y]=ndgrid(1:6); xyz=[X(:),Y(:),Z(:)]; %36x3 format

Making a function to restructure matrix of coordinates

Z=reshape(xyz(:,3),6,6); %6x6 format and then to revert back, [X,Y]=ndgrid(1:6); xyz=[X(:),Y(:),Z(:)]; %36x3 format

1 month ago | 0

| accepted

Answered

Update a value class property only if required

You have two separate issues that need to be addressed. The issue of handle class versus value class is the easier of the two. T...

Update a value class property only if required

You have two separate issues that need to be addressed. The issue of handle class versus value class is the easier of the two. T...

1 month ago | 1