# 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 276,177

REPUTATION**27,428**

CONTRIBUTIONS

**230** Questions

**10,539** Answers

ANSWER ACCEPTANCE **
75.65%
**

VOTES RECEIVED**3,585**

RANK**227** of 18,592

REPUTATION**5,922**

AVERAGE RATING**4.90**

CONTRIBUTIONS**35** Files

DOWNLOADS **468**

ALL TIME DOWNLOADS**49645**

RANK

of 125,916

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

curve fitting of two equation to two data sets simultaneously

lsqcurvefit will do it. ab=lsqcurvefit(@modelFcn,[a0,b0],x(:),[G1(:),G2(:)]); function f=modelFcn(p,x) a=p(1); b=p(...

2 hours ago | 0

table from the variable from the loop

j=0; for w=W_takeoff:-50:W_landing j=j+1; V(j,1) = sqrt(2*w/rho/S/cl_max); D(j,1) = 0.5 * rho * V(j) * ...

15 hours ago | 0

How to concatenate an array?

dataTT=[]; while true dataTT = [dataTT, read(MQTTSignal)]; str = dataTT(end).Data; ... end

22 hours ago | 0

How to divide 256X256 matrix into sixteen 16X16 blocks?

You can download mat2tiles from, https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-divide-array-into-equal-...

23 hours ago | 1

I'm having trouble with convolution1dLayer

You need a sequenceInputLayer rather than a featureInputLayer. Also, the dimensions of the training data must be re-organized. ...

1 day ago | 0

Error on convolutional layer's: input data has 0 spatial dimensions and 0 temporal dimensions.

You need a sequenceInputLayer rather than a featureInputLayer. Also, the training data must be re-organized so that spatial dime...

1 day ago | 0

The training images are of size 224×224×3 but the input layer expects images of size 224×224×1.

imageInputLayer([224 224 3])

1 day ago | 0

How to define a step in the design interval using an optimization algorithm?

You can constrain an optimization variable to integers with the intcon argument. Then, you can multiply this variable by some sc...

2 days ago | 0

| accepted

Con2vert with 5 dimensions Error: Arrays have incompatible sizes for this operation.

I recommend using lcon2vert instead, A = [0 1 0 1 1; 1 0 0 0 0; -1 -3 1 -3 0; 2 0 -1 3 -6; 0 -1 0 0 0; 0 0 -1 0 0; 0 0 0 -1 0; ...

2 days ago | 1

| accepted

Graphing several curves of a variable for various values of a parameter

%Plotting on command window BETAS=[0, 0.2, 0.4, 0.6, 0.8]; for i=1:numel(BETAS) beta=BETAS(i); [t,y] = ode23s(...

3 days ago | 1

| accepted

Improving efficiency and runtime to use a binary mask to sort another set of XY coordinates?

binaryMask = zeros(1868); %determine center of the circle and radius y_center = 921; x_center = 921; radius = 150; [xx, yy]...

3 days ago | 1

| accepted

I'd like to merge two different tables on matlab, how do I do that?

Time1 = ["t1";"t2";"t3"]; value1 = [374; 164; 476]; value2 = [2455;5478;2354]; value3 = [53782;35683;24682]; table1 = table(...

3 days ago | 0

Faster way of appending data to large struct array

That is a quite a bit of data. Even in single precision, the array will consume ~3 GB. Ths should be faster, though. stats=nan(...

4 days ago | 0

| accepted

Constrained Optimization Problem With Obj Function Which Is Numerical Solution To A System Of ODE's

Perhaps you might use fmincon as follows: A=kron( eye(4) , ones(1,52)); b=[300;10;1;1]; %summation constraints Aeq=[]; beq=[];...

4 days ago | 0

Problem with nonlinear objective function

prob.Objective.OF2 = "max"; "max" is just a string. There is no optimization expression that can be interpreted from it.

4 days ago | 1

| accepted

Sum two matrices shifted by a non integer number?

Because of the linearity of interpolation, you should not interpolate each matrix. You should sum the matrices first, then inter...

4 days ago | 0

| accepted

Optimising my data importer for large datasets

I don't see any pre-allocation of udata. Also, nothing is being done with x, so it will cut down on time if you don't create it....

4 days ago | 0

Calculate 3D gradient of data corrisponding to a non-uniform grid

I would just compute the Jacobian matrix of the spherical to cartesian coordinate transformation and multiply the spherical grad...

4 days ago | 0

| accepted

Write the f(c) as an anonymous function

Is this correct? There is no need for abs(). Also, your division and exponentiation operations need to be element-wise, f = @...

4 days ago | 1

| accepted

3 subplots with the bottom one split in 2 vertically?

Is this what you mean? close all x = -10:0.01:10; y = cos(x); ax=subplot(2,2,[1,2]); axis square plot(x,y) ax.Position...

4 days ago | 0

Find the elements of array with the difference between one of the remaining elements less than specified

A=[1 18 25; 26 30 11; 5 31 20]; thresh=2; [m,n]=size(A); p=m*n; D=abs( A(:)-A(:)' ); D(1:p+1:end)=inf; [I,J]=find(resh...

6 days ago | 1

| accepted

Create unit vector for every vector in 3d array

normalize(yourArray,1,'n')

6 days ago | 0

| accepted

Create multidimensional rotation matrix

howbig=541; [aclon,aclat]=deal(rand(howbig,1)); %fake input data aclon=reshape(aclon,1,1,[]); aclat=reshape(aclat,1,1,[]...

6 days ago | 0

| accepted

How to added a attention layer in a CNN model in MatLab?

This looks relevant: https://www.mathworks.com/matlabcentral/answers/1743390-how-to-create-an-attention-layer-for-deep-learning...

6 days ago | 0

How to conditionally define a learnable property?

If you really must have a layer with different properties, based on a conditional flag setting, it would probably be better to ...

7 days ago | 1

Combine 3 fig. graphs in one plot to compare each other

Suppose ax is a vector of axes handles to all of your separate plots. Then, you could re-parent the axes to a TiledChartLayout i...

7 days ago | 0

| accepted

Optimization problem with cost function containing definite integral with one endpoint being part of the solution vector

You've written your functions in terms of 2 arguments (p,S), whereas fseminf expects all the unknowns to be part of one argument...

7 days ago | 0

| accepted

Tensor creation like "pageTensorprod"?

Is there an easier way? The resulting code lacks readability in my opinion. Probably not, but regardless, readability shouldn't...

7 days ago | 0

| accepted