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

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

| accepted

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

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

| accepted

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

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

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

| accepted

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)

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

| accepted

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

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

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

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

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

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

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

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

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

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

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

| accepted

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

| accepted

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

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

| accepted

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

Generate random numbers with truncated Pareto distribution
According the https://en.wikipedia.org/wiki/Pareto_distribution the pareto has bounded on the lower side by what they called xm...

inpolygon usage with big matrices or faster function
Try this https://fr.mathworks.com/matlabcentral/fileexchange/27840-2d-polygon-interior-detection?s_tid=srchtitle At some point ...

| accepted

2 vectors compare it
A=[2 3 4 5 10 7 15 9 16 12 17 18 19 20]; [As,is] = sort(A(:)); col = 1 + (is>size(A,1...