Answered
Fmincon failure in optimizing an objective function which includes determinant of a matrix.
Make sure your objective function returns real numerical output Nr=4;No=1; N = 4; h = sqrt(0.5)*(randn(N,N)+1i*randn(N,N)); ...

3 years ago | 0

| accepted

Answered
EASY QUESTION ABOUT THE lsqlin COMMAND: Is it possible to use the lsqlin algorithm for MIMO systems (always with linear constraints)?
As long as you have a linear least-squares model, linear equality and inequality constraints then yes you can use lsqlin, as cl...

3 years ago | 0

Answered
A very fast way to find elements and their indices? (Is ismember fast?)
You overly complicate your code for nothing, and yes ismember if fast. Not sure if your a is always single element or just in t...

3 years ago | 1

| accepted

Answered
A very fast way to sort datetime (in "ascend" mode)?
The first peak is due to JIT that is not kicks in. Here is the result on my PC (code attached) I have to chase what create t...

3 years ago | 0

Answered
How can I derive inverse of the matrix with infinite determinant?
"Is there way to compute the inverse of the matrix A?" No. The sum of all columns of your matrix A is numerically 0, therefore...

3 years ago | 2

Answered
How can I derive inverse of the matrix with infinite determinant?
Welcome to the world of numerical calculation. Every conclusion you made is wrong. "det(A) = Inf Therefore, it cannot compute t...

3 years ago | 3

Answered
How to fill a vector and change its elements when reaching a specific element?
x = zeros(1, 3600); x(1) = 0; dx = 20; for k=2:length(x) xk = x(k-1) + dx; if xk > 1000 dx = -20; ...

3 years ago | 0

| accepted

Answered
Elimination of for loops
L=2; T=1; w0=2*pi; N=3; % Any t as you like without restriction t = linspace(0,L*T,500); l = floor(t / T); dt = mod(t...

3 years ago | 0

Answered
Does the base Matlab have something similar to Java's command 'setDefaultCloseOperation'?
https://fr.mathworks.com/help/matlab/creating_plots/define-an-object-deletion-callback.html

3 years ago | 0

Answered
Does the latest version of MATLAB support fmincon with gpuarray?
Discuss recently about this limitation of optimizer functions, no currently they won't support GPU array.

3 years ago | 1

| accepted

Answered
"uigetfile" only opens the matlab drive, not local file explorer
uigetfile open a file browser controller by the operating system. Usually user can navigate whereever he is allowed and in the ...

3 years ago | 0

Answered
Why is the derivative of a matrix not of the same order?
I guess you mistaken between numerical finite difference https://fr.mathworks.com/help/matlab/ref/diff.html and symbolic deriv...

3 years ago | 0

Answered
In my code the parfor is slower than for loop when using backslah with matrices.
There is no problem. There might be no benefit to run parfor on function that is designed with multithread and already exploit...

3 years ago | 5

| accepted

Answered
Count the number of times a particular sequence occurs in the vector.
Not for-loop but it does the job A=randi(0:1,1,10) spattern = [0 1]; startidx = strfind(A,spattern)

3 years ago | 0

Answered
Determine the number of elements in succession in a vector that are equal in a succinct way
You can use many runlength in filesubmission. I use here my own; x = [4 4 4 4 4 1 1 1 1 1 1 2 2 2 2 2 2 2 4 4 4 4 4 4 4] [le...

3 years ago | 0

| accepted

Answered
Vectorisation to replace for loop: Steganography text hiding
Second take: d = nan(numel(px),1); d(LSB===0) ) = 1; d(LSB===1) ) = -1; d(LSB==binaryTxt) = 0; b = isfinit(d); pxk = px(is...

3 years ago | 0

Answered
Best Practice: Many Functions relying on Global Variables?
May be a little cumbersome but for serious application and when I'm not lazy, I define a subclass UniversalParameterClass of Sin...

3 years ago | 1

Answered
Find a number and range of group of the same number
A= [1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 1 1 2 2 1 1 3 3 3 3 3 1 1 1 2 2 2 ]; [u,~,G]=unique(A); n = length(u); for g=1:n i = f...

3 years ago | 0

Answered
How to fit a data to a model without using Statistical Toolbox?
Polynomial fits can be done with linear algebra, no fminsearch is required, but yeah clearly the model cannot fit data with thre...

3 years ago | 2

Answered
Null space solutions in the presence of noise
You can call [x_lsq ,a] = eigs(@(x) (S'*S)\x, size(S,2), 1, 'smallestabs') where S is your (sparse) matrix sqrt(a) is the sma...

3 years ago | 0

Answered
problem with scatteredInterpolant: are there any limits?
You'll have problem anyway since your data is not centered and especially not normalize. x range is 130 and y range is 1155688,...

3 years ago | 1

Answered
Solving an implicit equation in matlab
D=1/(V-b) is a root of fifth order polynomial, where the coefficients depend on P, T, etc... It looks like it is small non-line...

3 years ago | 0

Answered
Solving an implicit equation in matlab
The numerical answer is -0.284179329144572 format long -(17211847986098922057056496272843303410021431145154622943954950247403...

3 years ago | 0

Answered
Creating curved alpha hull, similar to R-package
Just plot the boundary as concave. Some time it doesn't work since the vert returned are not in order, I don't know why and coul...

3 years ago | 2

Answered
Is it possible to find the limit as a function approaches a complex number?
If seem that what you want can be derived from the the Laurent series of G about p_i I have no idea if Matlab symbolc can compu...

3 years ago | 1

Answered
How do I calculate the correlation between the rows two large matrices?
Just use the formula of correlation % Fake data for testing A = rand(10,5); B = rand(10,5); Ac = A - mean(A,2); Bc = B - ...

3 years ago | 0

| accepted

Answered
How to generate uniformly distributed points inside the volume of frustrum with base radius R and tip radius r and with a height of h.
Here we go r = 1; R = 2; % must be > r h = 3; if R <= r error('Non valid parameter') end Zmin = r*h/(R-r); % Posi...

3 years ago | 0

| accepted

Answered
solving nonlinear equation including max function
The dumb method (buts surely reliable and give all possible solution) is to assume one of the 4 combinations rhs max in (1) is ...

3 years ago | 0

Answered
While loop not breaking even though condition is met.
Just guessing; Might be it breaks but your function is entered again or there are many instances of function in queue, log more ...

3 years ago | 1

| accepted

Answered
Applying boundary conditions on a cubic spline interpolation
You can use my function spline1d available here https://fr.mathworks.com/matlabcentral/fileexchange/24996-spline-derivative?s_ti...

3 years ago | 0

Load more