Answered

Readability of matlab code

Why not use object oriented programing? Put your external parameters in properties. Put your functions as methods. Implement an...

Readability of matlab code

Why not use object oriented programing? Put your external parameters in properties. Put your functions as methods. Implement an...

1 día ago | 0

Answered

Piecewise differentiation, automatic identification of pieces

https://www.mathworks.com/matlabcentral/answers/587987-linear-segmentation-of-noisy-data?s_tid=ta_ans_results

Piecewise differentiation, automatic identification of pieces

https://www.mathworks.com/matlabcentral/answers/587987-linear-segmentation-of-noisy-data?s_tid=ta_ans_results

4 días ago | 2

Answered

Why Contour matrix M ( [M,c] = contour(__) ) contains the data points exceeding xmax/ymax?

[M,h]=contourf(f,8) Return contours of 8 levels, not single level of value 8. You might use this function to decode the output...

Why Contour matrix M ( [M,c] = contour(__) ) contains the data points exceeding xmax/ymax?

[M,h]=contourf(f,8) Return contours of 8 levels, not single level of value 8. You might use this function to decode the output...

7 días ago | 0

| accepted

Answered

What frustrates you about MATLAB? #2

Some time data comes as single, but text just rejects it >> x=single(0); >> y=single(0); >> text(x,y,'Why single is not suppo...

What frustrates you about MATLAB? #2

Some time data comes as single, but text just rejects it >> x=single(0); >> y=single(0); >> text(x,y,'Why single is not suppo...

8 días ago | 1

Answered

How can I get randperm to return a permutation of a vector that has no entries at their original positions?

Here is an implementation of a non-rejection method and unbiased random derangement: function p = randder(n) % p = randder(n) ...

How can I get randperm to return a permutation of a vector that has no entries at their original positions?

Here is an implementation of a non-rejection method and unbiased random derangement: function p = randder(n) % p = randder(n) ...

9 días ago | 1

Answered

matrix in special arrangment for cycler gemetry

>> A=[11 12 13 14 15] A = 11 12 13 14 15 >> toeplitz(A,A) ans = 11 12 13 14 15 ...

matrix in special arrangment for cycler gemetry

>> A=[11 12 13 14 15] A = 11 12 13 14 15 >> toeplitz(A,A) ans = 11 12 13 14 15 ...

10 días ago | 0

| accepted

Answered

how matlab stores graphics objects?

All graphic objects are class "handle". Handles is a identify to designate the object and it's obviously 8 bytes as showed by wh...

how matlab stores graphics objects?

All graphic objects are class "handle". Handles is a identify to designate the object and it's obviously 8 bytes as showed by wh...

10 días ago | 0

Answered

speeding up my for loop

function y=divisors2(N) f = factor(N); [~,~,J] = unique(f); n = accumarray(J,1); y = prod(n+1); end Test >> N=27022021 ...

speeding up my for loop

function y=divisors2(N) f = factor(N); [~,~,J] = unique(f); n = accumarray(J,1); y = prod(n+1); end Test >> N=27022021 ...

10 días ago | 1

| accepted

Answered

Check if nullspace is contained in another + finding intersection of 2 nullspaces.

First question: KA = null(A); KB = null(B); % Check span KA is included in span KB PKA = KB*(KB'*KA); % Projection KA on ...

Check if nullspace is contained in another + finding intersection of 2 nullspaces.

First question: KA = null(A); KB = null(B); % Check span KA is included in span KB PKA = KB*(KB'*KA); % Projection KA on ...

10 días ago | 1

Answered

How can I get randperm to return a permutation of a vector that has no entries at their original positions?

This will do what you ask for https://www.mathworks.com/matlabcentral/fileexchange/30189-randpermfull?s_tid=srchtitle Even bet...

How can I get randperm to return a permutation of a vector that has no entries at their original positions?

This will do what you ask for https://www.mathworks.com/matlabcentral/fileexchange/30189-randpermfull?s_tid=srchtitle Even bet...

10 días ago | 0

| accepted

Answered

Theory of Bicubic interpolation

It has been answered here https://www.mathworks.com/matlabcentral/answers/78116-algorithm-of-bicubic-interpolation In 2D you d...

Theory of Bicubic interpolation

It has been answered here https://www.mathworks.com/matlabcentral/answers/78116-algorithm-of-bicubic-interpolation In 2D you d...

13 días ago | 0

Submitted

Free-knot spline approximation

Least squares approximation of 1D data using free-knots spline

13 días ago | 23 downloads |

Answered

Finding LAT LONG inside a circle of a given LAT LONG .

% Random data lonA=rand*360; latA=rand*180-90; n = 10000; lonP=rand(1,n)*360; latP=rand(1,n)*180-90; earthradius = 6357;...

Finding LAT LONG inside a circle of a given LAT LONG .

% Random data lonA=rand*360; latA=rand*180-90; n = 10000; lonP=rand(1,n)*360; latP=rand(1,n)*180-90; earthradius = 6357;...

17 días ago | 0

| accepted

Answered

HELP. Need to understand MATH behind scatteredInterpolant or Interp2 function

"Based on the equation that I had in that screen shot would you assume that the other model is using a simplified linear interpo...

HELP. Need to understand MATH behind scatteredInterpolant or Interp2 function

"Based on the equation that I had in that screen shot would you assume that the other model is using a simplified linear interpo...

20 días ago | 0

| accepted

Answered

How to generate a nearly symmetric matrix?

Just generate first a symettric matrix then perturb a "the overwhelming minority" of elements. Whatever that definnition means....

How to generate a nearly symmetric matrix?

Just generate first a symettric matrix then perturb a "the overwhelming minority" of elements. Whatever that definnition means....

20 días ago | 1

| accepted

Answered

HELP. Need to understand MATH behind scatteredInterpolant or Interp2 function

Run this, that show the "formula" and how to get zq = -38.5561 zq_check = -38.5561 Code to check 'linear' met...

HELP. Need to understand MATH behind scatteredInterpolant or Interp2 function

Run this, that show the "formula" and how to get zq = -38.5561 zq_check = -38.5561 Code to check 'linear' met...

20 días ago | 0

Answered

In a vector, how to remove neighbours too close from one another

Using stock function >> uniquetol([1 6 12 17 23 25 34],10,'DataScale',1) ans = 1 12 23 34 Jan's various ...

In a vector, how to remove neighbours too close from one another

Using stock function >> uniquetol([1 6 12 17 23 25 34],10,'DataScale',1) ans = 1 12 23 34 Jan's various ...

25 días ago | 2

Answered

Generate random integers that sums to a specific number within a specific range

Unfortunately the uniform distribution with bounds for integer is much more challenging. One way is to approximate by rounding t...

Generate random integers that sums to a specific number within a specific range

Unfortunately the uniform distribution with bounds for integer is much more challenging. One way is to approximate by rounding t...

27 días ago | 0

Answered

How to calculate the pairwise distince between two dataset without any loop

If you have latest MATLAB release (for pagemtimes) and download this Multiple same size solver FEX X = [1 2 1;3 4 2;5 6 3] Y =...

How to calculate the pairwise distince between two dataset without any loop

If you have latest MATLAB release (for pagemtimes) and download this Multiple same size solver FEX X = [1 2 1;3 4 2;5 6 3] Y =...

alrededor de 1 mes ago | 0

| accepted

Answered

How could I separate the geometry data from single stl file contains multiple objects by stlread?

You can use conncomp of the triangulation graph data=stlread('research_stl_read.stl'); s=data.ConnectivityList(:,[1 2]); t=...

How could I separate the geometry data from single stl file contains multiple objects by stlread?

You can use conncomp of the triangulation graph data=stlread('research_stl_read.stl'); s=data.ConnectivityList(:,[1 2]); t=...

alrededor de 1 mes ago | 1

| accepted

Answered

Why the abbrevation of "Left side of equation" is "lhs"

left hand side

Why the abbrevation of "Left side of equation" is "lhs"

left hand side

alrededor de 1 mes ago | 2

| accepted

Answered

How to Find the Rotation Matrix?

You equation is NOT enough to determine the third column, you forget about the orthogonal conditions and that det(R)=1 (rotation...

How to Find the Rotation Matrix?

You equation is NOT enough to determine the third column, you forget about the orthogonal conditions and that det(R)=1 (rotation...

alrededor de 1 mes ago | 3

Answered

Shortest path in a 2d matrix

%W=[ 1 2 3; % 4 5 6; % 7 8 9 ] W = randi(9,5,5) % Build the 4-connected graph [m, n] = size(W); [i, j] = ndgrid(1:m,1:n)...

Shortest path in a 2d matrix

%W=[ 1 2 3; % 4 5 6; % 7 8 9 ] W = randi(9,5,5) % Build the 4-connected graph [m, n] = size(W); [i, j] = ndgrid(1:m,1:n)...

alrededor de 1 mes ago | 2

| accepted

Answered

Selecting a "random" element from an array with each element having it's own weighting

A=[1,2,3,4]; p=[10 20 30 40]; c=cumsum(p); [~,r]=histc(rand(1,1e6),[0 c/c(end)]); % generate 1e6 numbers r=A(r); % Chec...

Selecting a "random" element from an array with each element having it's own weighting

A=[1,2,3,4]; p=[10 20 30 40]; c=cumsum(p); [~,r]=histc(rand(1,1e6),[0 c/c(end)]); % generate 1e6 numbers r=A(r); % Chec...

alrededor de 1 mes ago | 1

| accepted

Answered

A QR complexity question

The O(n^3) is number of flops, which is not proportional to tic/toc. You time also RANDN Calling QR has overhead that is signi...

A QR complexity question

The O(n^3) is number of flops, which is not proportional to tic/toc. You time also RANDN Calling QR has overhead that is signi...

alrededor de 1 mes ago | 2

| accepted

Answered

How to Solve this Big System of Equations

Possible causes: your matrix is wrongly constructed you forget to include proper boundary conditions you forget to add condit...

How to Solve this Big System of Equations

Possible causes: your matrix is wrongly constructed you forget to include proper boundary conditions you forget to add condit...

alrededor de 1 mes ago | 1

| accepted

Answered

fill matrix with all options of successive, increasing numbers 1-5

p = 5; n = 12; j = nchoosek(2:n,p-1); m = size(j,1); % == nchoosek(n-1,p-1) == 330 and not 96 i = repmat((1:m)',1,p-1); A...

fill matrix with all options of successive, increasing numbers 1-5

p = 5; n = 12; j = nchoosek(2:n,p-1); m = size(j,1); % == nchoosek(n-1,p-1) == 330 and not 96 i = repmat((1:m)',1,p-1); A...

alrededor de 1 mes ago | 1

| accepted

Answered

How do I find a D matrix that satisfies [K]*inv(M)*[D]==[D]*inv(M)*[K] ?

You have homogeneous linear equation, the entire null space of operator (D considered as input) K*inv(M)*D-D*inv(M)*K (dimensi...

How do I find a D matrix that satisfies [K]*inv(M)*[D]==[D]*inv(M)*[K] ?

You have homogeneous linear equation, the entire null space of operator (D considered as input) K*inv(M)*D-D*inv(M)*K (dimensi...

alrededor de 1 mes ago | 2

Answered

Remove overlapping intervals from two array intervals without using a loop

You might interest to use my interval-merging FEX

Remove overlapping intervals from two array intervals without using a loop

You might interest to use my interval-merging FEX

alrededor de 1 mes ago | 0