Answered

Converting a 3D Matrix to multiple 2D matrices

Assuming A is array 1000 x 1000 x 40 C = num2cell(A,[1 2]);

Converting a 3D Matrix to multiple 2D matrices

Assuming A is array 1000 x 1000 x 40 C = num2cell(A,[1 2]);

3 days ago | 1

| accepted

Answered

Multiply all pages of a matrix

AFAIK there is no alternative way in general; unless your matrices has special property that can use some simplification.

Multiply all pages of a matrix

AFAIK there is no alternative way in general; unless your matrices has special property that can use some simplification.

5 days ago | 0

| accepted

Answered

Using addpath on Compiled Code

I can't see addpath in your snip of code. When you compile the app, all the source mfiles used by you app MUST be found by depe...

Using addpath on Compiled Code

I can't see addpath in your snip of code. When you compile the app, all the source mfiles used by you app MUST be found by depe...

5 days ago | 0

Answered

Matlab interpolation between two surfaces

Assuming your two original surfaces are z1 and z2, juts pick w scalar in (0,1) interval, zinterp = (1-w)*z1 + w*z2; If w == 0 ...

Matlab interpolation between two surfaces

Assuming your two original surfaces are z1 and z2, juts pick w scalar in (0,1) interval, zinterp = (1-w)*z1 + w*z2; If w == 0 ...

5 days ago | 0

Answered

Matlab executable not running on remote access files

"I would like to change the directories for reading and writing theses files." IIRC the cd command is non effective in deployed...

Matlab executable not running on remote access files

"I would like to change the directories for reading and writing theses files." IIRC the cd command is non effective in deployed...

5 days ago | 0

Question

Answers editor seems to be broken

I can't see the editor tool in some PC display config + Firefox After a simple view of the thread it ask me as if I would edit ...

6 days ago | 1 answer | 0

Question

Is FORMAT DEBUG still any useful?

Can someone has an explanation for this (R2020B) clear clc x=1; y=x; x=x+1; format debug y x that produces y = ...

7 days ago | 1 answer | 1

Answered

Two linear equation with absolute value equation

Correct minimum norm solution is xmin = 90.0000 -40.0000 5.0000 5.0000 normxmin = 98.7421 obtain...

Two linear equation with absolute value equation

Correct minimum norm solution is xmin = 90.0000 -40.0000 5.0000 5.0000 normxmin = 98.7421 obtain...

7 days ago | 1

| accepted

Answered

Rearranging a 512x64 matrix into a 32x1024 matrix

% Assuming A is your input matrix of size 512 x 64 % such as % A=reshape(1:512*64,64,512)'; B = reshape(permute(reshape(A,[...

Rearranging a 512x64 matrix into a 32x1024 matrix

% Assuming A is your input matrix of size 512 x 64 % such as % A=reshape(1:512*64,64,512)'; B = reshape(permute(reshape(A,[...

7 days ago | 1

| accepted

Answered

generate random number with total sum is 10

For the case of more generic sum of n variables Xi is equal to 1. If the apriori distribution is supposed to be uniform density...

generate random number with total sum is 10

For the case of more generic sum of n variables Xi is equal to 1. If the apriori distribution is supposed to be uniform density...

7 days ago | 1

Answered

Is fmincon appropriate for optimizing vector-valued optimization variables (scalar obj. function)?

Yes fmincon supposes to handle optimization problems on objective function that depends on vector of real values. There is no re...

Is fmincon appropriate for optimizing vector-valued optimization variables (scalar obj. function)?

Yes fmincon supposes to handle optimization problems on objective function that depends on vector of real values. There is no re...

8 days ago | 0

| accepted

Answered

How do I map array values on a logical array

Result = zeros(size(B)); Result(B==1)=A

How do I map array values on a logical array

Result = zeros(size(B)); Result(B==1)=A

8 days ago | 1

Answered

Find the line where 2 planes intersect

% Planes implicit equations are: % a1*x + b1*y + c1*z = d1; % a2*x + b2*y + c2*z = d2; % a1 = 256; b1=0; c1=0; d1=0; ...

Find the line where 2 planes intersect

% Planes implicit equations are: % a1*x + b1*y + c1*z = d1; % a2*x + b2*y + c2*z = d2; % a1 = 256; b1=0; c1=0; d1=0; ...

8 days ago | 1

| accepted

Answered

subsref works as not expected

I knew it for sometime: subsref never work to emulate comma list (not sure if it's documented), because a non trivial comma list...

subsref works as not expected

I knew it for sometime: subsref never work to emulate comma list (not sure if it's documented), because a non trivial comma list...

8 days ago | 0

| accepted

Answered

Quadratic-Equation-Constrained Optimization

There is https://www.mathworks.com/help/optim/ug/coneprog.html but only for linear objective function. You migh iterate on b...

Quadratic-Equation-Constrained Optimization

There is https://www.mathworks.com/help/optim/ug/coneprog.html but only for linear objective function. You migh iterate on b...

8 days ago | 0

| accepted

Answered

Resize and sum a matrix

If you isist on "resize" array1 =[1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Resize and sum a matrix

If you isist on "resize" array1 =[1 2 3 4 5 6 7 8 9 10 11 12 13 ...

9 days ago | 0

Answered

Preallocating a structure with a changing number of rows within a field

There is no need to preallocate a field (or in fact any variable) if you don't grow the array itself in a loop, which is your ca...

Preallocating a structure with a changing number of rows within a field

There is no need to preallocate a field (or in fact any variable) if you don't grow the array itself in a loop, which is your ca...

11 days ago | 0

Answered

Find out number of bits needed to represent a positive integer in binary?

>> I=0:9 I = 0 1 2 3 4 5 6 7 8 9 >> n=nextpow2(I+1) n = 0 1 ...

Find out number of bits needed to represent a positive integer in binary?

>> I=0:9 I = 0 1 2 3 4 5 6 7 8 9 >> n=nextpow2(I+1) n = 0 1 ...

11 days ago | 1

Answered

How to use min function so that it stops at the first minimum value in a column matrix, stores values, and then continues going until it finishes the entire matrix? (details below)

A=[0.200 0.300 0.400 0.001 0.002 0.003 0.004 0.003 0.002 0.001] imin=find(A==min(A)); lgt=diff(union(imin,[0 length(A)])) C...

How to use min function so that it stops at the first minimum value in a column matrix, stores values, and then continues going until it finishes the entire matrix? (details below)

A=[0.200 0.300 0.400 0.001 0.002 0.003 0.004 0.003 0.002 0.001] imin=find(A==min(A)); lgt=diff(union(imin,[0 length(A)])) C...

11 days ago | 0

Answered

Generation of Conditional Random Variables

I don't quite understand what you want but from your request you seem to compute X1 = C1 * S X2 = C2 * S ... X16 = C16 * S ...

Generation of Conditional Random Variables

I don't quite understand what you want but from your request you seem to compute X1 = C1 * S X2 = C2 * S ... X16 = C16 * S ...

11 days ago | 0

| accepted

Answered

Obtain a random number from a truncated normal distribution

In theory if you range is something +/-0.9*0.03 the maximum possible standard deviation you can reach with a truncated gaussian ...

Obtain a random number from a truncated normal distribution

In theory if you range is something +/-0.9*0.03 the maximum possible standard deviation you can reach with a truncated gaussian ...

12 days ago | 0

Answered

Convert a symmetrical 4D array into a vector of it's degrees of freedom and vice-versa

% A = zeros(7,7,7,7); n = length(A); % 7 m = ndims(A); % 4 C = cell(1,m); [C{:}] = ndgrid(1:n); I = reshape(cat(m+1,C{...

Convert a symmetrical 4D array into a vector of it's degrees of freedom and vice-versa

% A = zeros(7,7,7,7); n = length(A); % 7 m = ndims(A); % 4 C = cell(1,m); [C{:}] = ndgrid(1:n); I = reshape(cat(m+1,C{...

13 days ago | 0

| accepted

Answered

Memory usage of functions like pause()

Pause by itself would not causes any issue. But as side effect it releases other parallel pending tasks and those might have mem...

Memory usage of functions like pause()

Pause by itself would not causes any issue. But as side effect it releases other parallel pending tasks and those might have mem...

13 days ago | 0

Answered

How to get fminimax work for both max and min objectives?

I wouldn't use fminmax. I would use linprog to maximize q as subfunction, and fmincon to minimize z,b. Beside you should tran...

How to get fminimax work for both max and min objectives?

I wouldn't use fminmax. I would use linprog to maximize q as subfunction, and fmincon to minimize z,b. Beside you should tran...

13 days ago | 1

Answered

Condition number of Hilbert matrix depending on MATLAB build??

You and the students should NOT expect COND returns identical result, especially for ill-conditionned matrix like Hilbert matrix...

Condition number of Hilbert matrix depending on MATLAB build??

You and the students should NOT expect COND returns identical result, especially for ill-conditionned matrix like Hilbert matrix...

14 days ago | 0

| accepted

Answered

Replace some values of a vector with values from another vector of the same size

Simply C = max(A,B)

Replace some values of a vector with values from another vector of the same size

Simply C = max(A,B)

14 days ago | 1

Answered

Solving a simple vectorial equation with one unknown

fsolve requires the number of unknowns == number of equations. This is the least-square solution f = @(x)norm([cross(OP,x*CD) ...

Solving a simple vectorial equation with one unknown

fsolve requires the number of unknowns == number of equations. This is the least-square solution f = @(x)norm([cross(OP,x*CD) ...

15 days ago | 0

Answered

fmincon, the size of the current step is less than the value of the step size tolerance, but constraints are not satisfied

I beleive the correct sign of A is "+" c_eq(i)= x'*Qi*x + A(i,:)*x - b(i);

fmincon, the size of the current step is less than the value of the step size tolerance, but constraints are not satisfied

I beleive the correct sign of A is "+" c_eq(i)= x'*Qi*x + A(i,:)*x - b(i);

16 days ago | 1

| accepted

Answered

Find the common eigenvectors and eigenvalues between 2 matrices

K = null(A-B); [W,D] = eig(K'*A*K); X = K*W, % common eigen vectors lambda = diag(D), % common vector

Find the common eigenvectors and eigenvalues between 2 matrices

K = null(A-B); [W,D] = eig(K'*A*K); X = K*W, % common eigen vectors lambda = diag(D), % common vector

16 days ago | 0