# Matt J

Professional Interests: medical image processing, optimization algorithms PLEASE NOTE: I do not read email sent through my author page. Please post questions about FEX submissions in their respective Comments section.

**Statistics**

RANK**6**

of 265 298

REPUTATION**25 414**

CONTRIBUTIONS

**220** Questions

**9 868** Answers

ANSWER ACCEPTANCE **
75.0%
**

VOTES RECEIVED**3 337**

RANK**238** of 18 130

REPUTATION**5 663**

AVERAGE RATING**4.90**

CONTRIBUTIONS**34** Files

DOWNLOADS **327**

ALL TIME DOWNLOADS**47393**

RANK

of 116 602

CONTRIBUTIONS

**0** Problems

**0** Solutions

SCORE**0**

NUMBER OF BADGES**0**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**3** Highlights

AVERAGE NO. OF LIKES**2**

**Content Feed**

linear combination of vector and permutation

One way: A=[-1,1];B=3; [Out{1:B}]=ndgrid(A); Out=reshape( cat(B+1,Out{:}),[],B)

environ 14 heures ago | 1

How to pair two set of coordinates together based on their Euclidean distance?

See matchpairs. The cost matrix can be obtained using pdist2.

environ 18 heures ago | 0

Coming back from gradient using circshift for image processing

No, you cannot. Any constant image, for example, has the same "gradient", so the process cannot be invertible.

environ 18 heures ago | 0

| accepted

Given a center, sum adjacent pixels

Use interp2: value=interp2(A,14.3,10.6)

environ 22 heures ago | 0

UseParallel for hessian?

I don't speak for MathWorks, but I think the issue is that finite difference Hessians are only relevant to the trust-region algo...

1 jour ago | 0

Why does my FFT highly depends on the resolution of the data?

The fft of a guassian should return a guassian as well. Remember, the FFT and the continuous Fourier transform are not the same...

2 jours ago | 0

2nd 3rd derivatives

x = [-2:0.01:1]; y = exp(-3.*x); dy=gradient(y,0.01); ddy=gradient(dy,0.01); plot (x(3:end),ddy(3:end))

3 jours ago | 0

| accepted

How to fill just such successive elements in row of matrix?

Is this what you want? A=[9, 50, 18 3; 11 7 50 10; 1 2 3 50; 50 3 4 5] B=cumsum(A==50,2)*50 C=B+~B.*A

3 jours ago | 0

imfreehand() closes the curve in the image but does not save those "closing" points

Use thte points to contruct a polyshape object, plot(polyshape(points))

3 jours ago | 1

imfreehand() closes the curve in the image but does not save those "closing" points

Copy the first point and append it to the end of the list

3 jours ago | 0

| accepted

To write a For loop in which a variable is updated with each run.

Why not just do, pgon=nsidedpoly(18); pgon.Vertices plot(pgon); axis equal

3 jours ago | 2

cant seem to make the background fully black

A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1141370/original.png'); B=imclose(edge(A),strel('dis...

4 jours ago | 1

cant seem to make the background fully black

A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1141370/original.png'); B=imquantize(A,multithresh(A...

4 jours ago | 1

| accepted

How to determine if a 3D line segment intersects a side of a 3D rectangular prism?

You can also use Siddon's algorithm https://aapm.onlinelibrary.wiley.com/doi/epdf/10.1118/1.595739 which will compute the int...

5 jours ago | 0

how to remove the tiny white pixels around the rectangles

imopen(yourImage,ones(3))

5 jours ago | 0

create a random matrix that satisfies specific criteria (graph theory)

Just permute the rows and columns of the original adjacency matrix, A, [~,is]=sort(rand(264),2); for k=1:264 A(k,:)=A(k,is...

5 jours ago | 0

How to determine if a 3D line segment intersects a side of a 3D rectangular prism?

You can use intersectionHull() in this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/30892-analyze-n-dimen...

6 jours ago | 2

| accepted

Can you please help me to get the square root of the sum of squares of the second column in the text file ?

Your attachment didn't make it, but assuming it's called yourFile.txt, [~,col]=readvars('yourFile.txt'); result = norm(col(~...

6 jours ago | 0

Matrix multiplication along a specified dimension?

B=pagemtimes(A,X)

6 jours ago | 0

| accepted

Why do I get an error using "-" along with the message "too many output arguments" when using fmincon?

You have not shown us fValue2, but more than likely, it does not specify any output arguments to be returned.

6 jours ago | 0

Extract the bigger number of values from the previous one in an array

Easier to do, Data = rand(1,15) X=10*(diff(Data)>0)

6 jours ago | 0

| accepted

Fit ellipse in 3D space

Another possibility is to use this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-to...

6 jours ago | 0

| accepted

Help using fmincon to find the 2 support locations (x1,x2) that minimize maximum bending moment

I need to minimize the maximum bending moment from 0 to L Do you mean the maximum from among [b1 b2 b3]? If so, you probably wa...

6 jours ago | 0

Find the key for vector transformation

See Example 2: Optimal Reordering of Points in the Examples tab of https://www.mathworks.com/matlabcentral/fileexchange/52795-c...

6 jours ago | 0

How to create a column vector repeating the same character n times?

and has the same character repeating in each row like 'on'. 'on' contains two characters. Repeating it for N rows would give a...

7 jours ago | 1

| accepted

Removal of the the edges from the node of a graph

You want to remove the edges but keep the node itself? If so, G=rmedge(G,outedges(G,nodeID)) If you want to remove the node an...

7 jours ago | 0

| accepted

How to obtain and plot perpedicular lines using the gradient of a function

Your plot is correct. The lines just don't look perpendicular because of the plot aspect ratio. x = linspace(-2,1,100)'; y ...

7 jours ago | 0

| accepted

Fit ellipse in 3D space

I am searching for intersection of plane and ellipsoid If that is the ultimate goal, you should just rewrite the ellipsoid equa...

7 jours ago | 0

How can I transparent my gaussian distribution and convert to a transparent ellipse

You can extract the points on the contour lines using tis FEX download https://www.mathworks.com/matlabcentral/fileexchange/740...

7 jours ago | 0

| accepted