Community Profile

# Matt J

Last seen: Today Active since 2009

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.

All

#### Content Feed

View by

How to create a Aij matrix with the commands 'for', 'function output=name_of_code' and 'imagesc'?
m=100; n=150; A=((1:m)'-(1:n)).^2; for i=1:min(m,n) A(i,i)=2*i.^2; end imagesc(A)

15 hours ago | 0

How to create a Aij matrix with the commands 'for', 'function output=name_of_code' and 'imagesc'?
I don't know how to do it and I didn't find any example. Not even here? https://www.mathworks.com/help/matlab/ref/for.html#bu...

16 hours ago | 0

Fill in values in function
Z = @(X,Y) (1.5-X+X.*Y).^2 +(2.25-X+X.*(Y.^2)).^2+(2.625-X+X.*(Y).^3).^2; Z(0,0)

16 hours ago | 1

| accepted

Parallelize nested loops with parfor
Never mind my other answer. I didn't notice that a_sim and h_sim were recursively defined. You can't avoid a loop, but you only ...

17 hours ago | 0

Parallelize nested loops with parfor
I don't think it makes sense to use any loops here at all. Just make vectorized calls to your griddedInterpolant objects. [~,~,...

17 hours ago | 0

How to interpret actual Camera Intrinsics/Principal Points results?
The uncertainty values look kind of large to me. I wonder if your 22 images are diverse enough.

17 hours ago | 0

Extracting two columns from 6-D complex double
T=table((1:numel(val))' , abs(val(:)).^2 )

23 hours ago | 0

| accepted

Effect of zero padding on FFT amplitude
When zero-padding such a signal one fundamentally change the signal from a constant-valued signal to a square-wave @Bjorn Gus...

23 hours ago | 0

How to find the closest values (positive and negative) to the line when X is zero?
load Data %Create line plot [x,is] = sort(V); y = J(is); in=find(x<0,1,'last'); ip=find(x>0,1,'first'); [xn,yn, ...

1 day ago | 0

| accepted

Objective function for fmincon from surrogate model
Can't you just do, fun=@(X) norm(mdl.predict(X)-y).^2

1 day ago | 0

| accepted

Is it possible to add more constraints than the default ones in LSQLIN function?
You can still use lsqlin, but as John said, you can add additional inequality constraints as follows, Q=-sign(d).*C; r=zeros(s...

2 days ago | 1

| accepted

Optimising Limits of Chain integrals
There is virtually no benefit to the problem based approach if you are going to use fminunc. The main advantage of problem-base...

2 days ago | 0

Cross-correlation of two complex signals using sliding dot product
If there is to be no zero-padding, what should happen when the shorter signal slides to the edge of the longer signal? Does the ...

2 days ago | 0

| accepted

Finding Roots between a Differential and Piecewise Equation
a=1; [t_root,fval]=fzero(@(t)rootFcn(t,a), pi) function out=rootFcn(t,a) xp1 =@(t) ((-(8*2)/(2^2+1))*cos(t))+((8/(2^2+...

2 days ago | 0

| accepted

Effect of zero padding on FFT amplitude
Here is an example showing that the amplitude of an FFT does not change due to zero-padding. In all cases, the peak amplitude is...

2 days ago | 0

Projection using Modified Gram-Schmidt orthogonality
Aorth=orth(A); %A orthogonalized ProjB=Aorth*(Aorth.'*B); %projection of B

2 days ago | 0

| accepted

How to use conditional bounds for parameters with lsqcurvefit?
You must divide the problem into two cases: one case where X0 is fixed at 0 and the second when Y0 is fixed at zero. xdata = 0:...

3 days ago | 3

| accepted

When using JacobianMultiplyFcn in lsqnonlin, why is Jinfo required to be numeric? How can I pass more general kinds of parameters to my JacobianMultiplyFcn?
I seem to be have been able to fool lsqnonlin into doing what I want by using the attached classdef. Still, I wonder why the Opt...

3 days ago | 0

Submitted

Tools for Processing Consecutive Repetitions in Vectors
A set of functions for labeling and manipulating groups of consecutively repeating elements in a vector.

How to group same value data
G=findgroups(A(:)); splitapply(@(x){x}, B(:),G)

3 days ago | 0

Latex typesetting in Livescript
I have expressed a desire to have \label{} and \ref{} in LiveScript, https://www.mathworks.com/matlabcentral/answers/1723075-au...

3 days ago | 0

calculate the euclidean distance among all the pairs of nodes and use those resulting distances as the edges weights of the graph
This is already done in spatialgraph2d() https://www.mathworks.com/matlabcentral/fileexchange/73630-spatialgraph2d which I thi...

4 days ago | 0

| accepted

Cut off a Curve created by "curve fit"
This might be what you want: for i = 1:12 x1 = [emax(i); emid(i); 0]; y1 = [vmax(i); vmid(i); dvc(i)]; p = pol...

4 days ago | 0

Question

When using JacobianMultiplyFcn in lsqnonlin, why is Jinfo required to be numeric? How can I pass more general kinds of parameters to my JacobianMultiplyFcn?
What I would like to do is use the JacobianMultiplyFcn option of lsqnonlin's trust-region-reflective algorithm where Jinfo is a...

4 days ago | 1 answer | 0

### 1

limiting broadcast variables in parfor loops
The block decomposition that you are doing needs more explanation. If the blocks are just fixed-sized, non-overlapping tiles of ...

4 days ago | 0

how to run a function on GPU cores
so it would be great if we could have a function like "parfor" for GPU-based parallel processing. No, you cannot use GPU cores ...

4 days ago | 0

| accepted

MATLAB Problem. How to design matrix from eigenvalues
mindist=@(A) min(sqrt(pdist(real(A(:))).^2+pdist(imag(A(:))).^2)); n=5; Q=rand(n); Q(1)=0; Q=(1-eye(n)).*Q*0.5/mindist(...

5 days ago | 0

| accepted

MATLAB Problem. How to design matrix from eigenvalues
mindist=@(A) min(sqrt(pdist(real(A(:))).^2+pdist(imag(A(:))).^2)); n=5; P=rand(n); D=diag(rand(1,n)); A=P*D/P; A=A/mi...

5 days ago | 1

extract data points where the slope (derivative) of the plot changes suddenly
data=[ 1 2 3 4 3 2 1] loc=abs(diff(data,2)) > 1 loc=[false, loc ,false]; %pad with zeros because diff() shortens the vect...

5 days ago | 0

Extracting data points (with specific coordinates) from plot
For example, Y=40+0.04*linspace(-1,1,10) data=10*(1:numel(Y)) data_Extracted = data(abs(Y-40)<=0.01)

5 days ago | 0