Answered

Does inpolygon work for latitudes and longitudes on the surface of the earth?

A polygon in lat/lon will NOT map to a "polygon" on the sphere. A "polygon" on the sphere composed by edges that are grand circl...

Does inpolygon work for latitudes and longitudes on the surface of the earth?

A polygon in lat/lon will NOT map to a "polygon" on the sphere. A "polygon" on the sphere composed by edges that are grand circl...

5 months ago | 0

Answered

Format number in the same format as disp

>> x=logspace(1,3,10) x = 1.0e+03 * 0.0100 0.0167 0.0278 0.0464 0.0774 0.1292 0.2154 0.3594...

Format number in the same format as disp

>> x=logspace(1,3,10) x = 1.0e+03 * 0.0100 0.0167 0.0278 0.0464 0.0774 0.1292 0.2154 0.3594...

5 months ago | 1

Answered

submitWithConfiguration not working in matlab R2019b

The problem is in the statement parts = parts(conf); In MATLAB 2019B, you cannot use the same name of variable and function, b...

submitWithConfiguration not working in matlab R2019b

The problem is in the statement parts = parts(conf); In MATLAB 2019B, you cannot use the same name of variable and function, b...

5 months ago | 2

| accepted

Answered

Getting error: Maximum recursion limit of 500 reached

Don't call name your GUI "GUIDE"

Getting error: Maximum recursion limit of 500 reached

Don't call name your GUI "GUIDE"

5 months ago | 0

| accepted

Answered

How to use cellstr() without losing whitespace character?

Pay attention to the difference between the two last commands >> c1={'1' '12' '123'} c1 = 1×3 cell array {'1'} ...

How to use cellstr() without losing whitespace character?

Pay attention to the difference between the two last commands >> c1={'1' '12' '123'} c1 = 1×3 cell array {'1'} ...

5 months ago | 1

| accepted

Answered

How to get number of occurrence in a list with gaps?

(EDIT for R2016a, not supported for strings.) % dummy test data d={'1/1/2019' '1/1/2019' '2/1/2019' '4/1/2019' '4/1/2019' ...

How to get number of occurrence in a list with gaps?

(EDIT for R2016a, not supported for strings.) % dummy test data d={'1/1/2019' '1/1/2019' '2/1/2019' '4/1/2019' '4/1/2019' ...

5 months ago | 0

| accepted

Question

Regular expression to match "="

In try to find a simple pattern p to match a single '=' but ignore '==' in a string So I want regexp('a = b', p) to return 3 ...

5 months ago | 1 answer | 0

Answered

Creating vectors with components

r=[3 2 7 5 2] r(1:min(5,end)).^2.' or r(1:min(5,end)).'.^2

Creating vectors with components

r=[3 2 7 5 2] r(1:min(5,end)).^2.' or r(1:min(5,end)).'.^2

5 months ago | 0

Answered

Find two ways to create a 3 x 5 matrix with all values equal to 100 (Hint: use ones and zeros).

(Not sure why an answered has been deleted) Method 1 100 + zeros(3,5) Method 2 100 * ones(3,5)

Find two ways to create a 3 x 5 matrix with all values equal to 100 (Hint: use ones and zeros).

(Not sure why an answered has been deleted) Method 1 100 + zeros(3,5) Method 2 100 * ones(3,5)

5 months ago | 0

Answered

3D surface plot (mode shape)

No MESHGRID calls are needed since your data are already gridded surf(x,y,R16) and surf(x,y,R109)

3D surface plot (mode shape)

No MESHGRID calls are needed since your data are already gridded surf(x,y,R16) and surf(x,y,R109)

5 months ago | 0

Answered

How to do forward, backward and central difference

You forget to divide the differences by the time step (dt) dt = 0.02 for j=1:101 xb=-1+(j-1)*dt; xbb=-1+(j-2)*dt; ...

How to do forward, backward and central difference

You forget to divide the differences by the time step (dt) dt = 0.02 for j=1:101 xb=-1+(j-1)*dt; xbb=-1+(j-2)*dt; ...

5 months ago | 1

| accepted

Answered

How to generate random matrix from another one?

A is your input matrix Ashuffle = reshape(A(randperm(numel(A))),size(A))

How to generate random matrix from another one?

A is your input matrix Ashuffle = reshape(A(randperm(numel(A))),size(A))

5 months ago | 0

Answered

Specific pseudo-randomised number generator.

n = 2*ones(2,50); for k=1:2 p=randperm(50,32); % you might randomize 32 as well (must be even number in [0,50]); n(k,...

Specific pseudo-randomised number generator.

n = 2*ones(2,50); for k=1:2 p=randperm(50,32); % you might randomize 32 as well (must be even number in [0,50]); n(k,...

5 months ago | 1

| accepted

Answered

How to create an n by n wilkinson matrix using diag

n = 10; W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);

How to create an n by n wilkinson matrix using diag

n = 10; W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);

5 months ago | 0

| accepted

Answered

Using ALLCOMB for unknown number of vectors

Create a CELL array, and get rid of the method of naming your variables with number 1,2,.... C = {A1, A2, A3, ..., AN} B = all...

Using ALLCOMB for unknown number of vectors

Create a CELL array, and get rid of the method of naming your variables with number 1,2,.... C = {A1, A2, A3, ..., AN} B = all...

5 months ago | 3

Answered

Check if a set of coordinates are on a line

xy=[x(:)';y(:)']; criteriatol = 0.01; % adjust to your need, smaller means stricter line test s = svd(xy-mean(xy,2)); islin...

Check if a set of coordinates are on a line

xy=[x(:)';y(:)']; criteriatol = 0.01; % adjust to your need, smaller means stricter line test s = svd(xy-mean(xy,2)); islin...

5 months ago | 1

| accepted

Answered

Convolution of two log normal distributions

LOGNORMAL is defined on (0,Inf) not (-Inf,Inf) P = integral2(fun,0,t - 'x',0,inf,'RelTol',1e-12,'AbsTol',1e-12) returns correc...

Convolution of two log normal distributions

LOGNORMAL is defined on (0,Inf) not (-Inf,Inf) P = integral2(fun,0,t - 'x',0,inf,'RelTol',1e-12,'AbsTol',1e-12) returns correc...

5 months ago | 0

Answered

find a column vector such that the determinant of a matrix A is non-zero?

A8 = [1 0 0 0 0 0 1 0; 0 1 0 0 0 0 0 1; 0 0 1 0 0 0 1 0; 0 0 0 1 0 0 0 1 ; 0 0 0 0 1 0 1 0; 0 0 0 0 0 1 0 1] ij=nchoosek...

find a column vector such that the determinant of a matrix A is non-zero?

A8 = [1 0 0 0 0 0 1 0; 0 1 0 0 0 0 0 1; 0 0 1 0 0 0 1 0; 0 0 0 1 0 0 0 1 ; 0 0 0 0 1 0 1 0; 0 0 0 0 0 1 0 1] ij=nchoosek...

5 months ago | 0

| accepted

Answered

Divide an array in n different arrays

V = [1 1 1 1 1 1 6 6 6 6 6 6 6 6 6 3 3 3 3 3 3 3 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2...

Divide an array in n different arrays

V = [1 1 1 1 1 1 6 6 6 6 6 6 6 6 6 3 3 3 3 3 3 3 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2...

5 months ago | 0

| accepted

Answered

How to fill interior as different color

Fill the hole with imfill Next you can color your integer image by defining the appropriate colormap % Generate test image con...

How to fill interior as different color

Fill the hole with imfill Next you can color your integer image by defining the appropriate colormap % Generate test image con...

5 months ago | 1

| accepted

Answered

How to do a matrix like this??

(1:10).^((1:3)') or on older MATLAB bsxfun(@power,1:10,(1:3)')

How to do a matrix like this??

(1:10).^((1:3)') or on older MATLAB bsxfun(@power,1:10,(1:3)')

5 months ago | 0

| accepted

Answered

Linear programming, interested in only 1 variable

If you want to minimize x1 under A*x <= b f = zeros(size(x)); f(1) = 1; x = linprog(f, A, b); (x2,...,xn) is not meaningless...

Linear programming, interested in only 1 variable

If you want to minimize x1 under A*x <= b f = zeros(size(x)); f(1) = 1; x = linprog(f, A, b); (x2,...,xn) is not meaningless...

5 months ago | 2

| accepted

Answered

What is the difference between using conv function and manual coding method using MATLAB?

Your twin brother/sister/class mate is faster, he/she asked the same question earlier. Don't copy the same answer, your teacher...

What is the difference between using conv function and manual coding method using MATLAB?

Your twin brother/sister/class mate is faster, he/she asked the same question earlier. Don't copy the same answer, your teacher...

5 months ago | 0

Answered

Find the cell index in a nested cell array, corresponding to a string (by using strcmp)

A{1} = { ... {'Up' } {'Down' } {'Left' } {'Right'} {'BLUE'} {'1' } {'7' } {'1' } {'8' } ...

Find the cell index in a nested cell array, corresponding to a string (by using strcmp)

A{1} = { ... {'Up' } {'Down' } {'Left' } {'Right'} {'BLUE'} {'1' } {'7' } {'1' } {'8' } ...

5 months ago | 1

Answered

Binary floating point Representation in Matlab

To overcome the limitation of dec2bin at 52 bits A=[ 0.1900 -0.0300 -0.1300 0 0.1500 -0.0700 0.0500 0.1600 -0.2500 -0.1900]...

Binary floating point Representation in Matlab

To overcome the limitation of dec2bin at 52 bits A=[ 0.1900 -0.0300 -0.1300 0 0.1500 -0.0700 0.0500 0.1600 -0.2500 -0.1900]...

5 months ago | 1

Answered

1d Convolution using Matlab's conv() function

Ba Ba Black Sheep wrote len(pad) = floor(len(v) / 2) Actually the above is wrong, In case CONV using with of 'same' option, t...

1d Convolution using Matlab's conv() function

Ba Ba Black Sheep wrote len(pad) = floor(len(v) / 2) Actually the above is wrong, In case CONV using with of 'same' option, t...

5 months ago | 0

| accepted

Answered

Convolution Computations results for a system response.

You make few mistakes, indexing and flipping (see careful conv documentation, the subtility is there, though TMW never mention w...

Convolution Computations results for a system response.

You make few mistakes, indexing and flipping (see careful conv documentation, the subtility is there, though TMW never mention w...

5 months ago | 0

| accepted

Answered

Find Common elements between any two columns in each matrix

Not sure but keyNeuronMat1(1:10,1:4) & keyNeuronMat2(1:10,5:8) Give you common neurons/groups.

Find Common elements between any two columns in each matrix

Not sure but keyNeuronMat1(1:10,1:4) & keyNeuronMat2(1:10,5:8) Give you common neurons/groups.

5 months ago | 0

| accepted