Answered
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...

3 years ago | 0

| accepted

Answered
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...

3 years 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...

3 years ago | 1 answer | 0

1

answer

Answered
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 ...

3 years ago | 0

| accepted

Answered
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 ...

3 years ago | 0

| accepted

Answered
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(...

3 years ago | 0

| accepted

Answered
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...

3 years ago | 1

Answered
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...

3 years ago | 0

Answered
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)

3 years ago | 0

Answered
Make loop more efficient
Simpler: A=rand(5), I=(A<0.5); A(I)=A(I)+1,

3 years ago | 0

| accepted

Answered
I am trying to replace the objective function of neural network to customised one
This talks about supplying a custom model function for NN training: https://www.mathworks.com/help/deeplearning/ug/train-networ...

3 years ago | 0

Answered
Use of fmincon with objective function as m-file
One way is to wrap the functions in an anonymous function: fun=@(X) objective_fn(V_exp, volt(O_plus,O_minus,X,L_a,L_c,I_app,t)...

3 years ago | 1

Answered
Fminsearch results shows shift from measured curve. How should I solve this?
The x_Start=[1,1] selection looks very arbitrary. If one of the parameters is the oscillation amplitude, it should be closer to ...

3 years ago | 0

Answered
Dividing each row in a 48X5120 int32 with the maximum value in the row
A=double(A); result = A./max(A,[],2)

3 years ago | 0

| accepted

Answered
Custom Matrix Interpolation for every 10 numbers in each column
A=reshape(1:40,[],2); A(10:end,:)=A(10:end,:)*2; A=A(1:5:end,:); %hypothetical input M=5; %upsampling factor A=kron(A...

3 years ago | 0

| accepted

Answered
latex in text doesn't work
gca; s=sprintf('$\\tilde{y}_x$ = %.3f',5) text(0.5, 0.5,s, ... 'Interpreter', 'LaTeX','fontsize', 30);

3 years ago | 0

Answered
Scaling in optimization problems
the derivate with dV/dc will get ever smaller with t. It's not clear that that matters because the values of c are also influe...

3 years ago | 0

| accepted

Answered
add constant value to row
A=readmatrix('yourFile.xlsx'); A(:,end+1)=600;

3 years ago | 0

Answered
Minimize a variable in a no-linear system
If you use the Problem Based optimization tools, you can pretty much type in the problem as you have for us above, and the solve...

3 years ago | 0

| accepted

Answered
run takes too long!
i have this code that it runs and answers are correct but it takes so long...why?is there any solution? It is unnecessary to us...

3 years ago | 0

| accepted

Answered
How to rotate a 2D array (2D image) in 3D space around the x-axis?
A=rand(5) theta=90; R=eye(3); R(2:3,2:3) = [ cosd(theta) -sind(theta); ... sind(theta) cosd(theta)]; A=...

3 years ago | 0

Answered
How can I remove some specific rows in which zero an nan values exist?
load stations2 cutrows=stations2(:,2)==0|isnan(stations2(:,2)); stations2 stations2(cutrows,:)=[]

3 years ago | 0

| accepted

Answered
Question about matrix manipulation
Using this FEX download, it's fairly easy: https://www.mathworks.com/matlabcentral/fileexchange/115340-block-transposition-perm...

3 years ago | 0

| accepted

Answered
introducing a comparison related to variables in linear programming
The constraints you describe are non-convex, so there is no way to formulate them in a linear way. However, you can modify your ...

3 years ago | 0

| accepted

Answered
Neat enclosed area for a group of points on a plane
Your attached Data.mat looks like it contains different Data from your posted figure illustrations. load Data shp=alphaShape...

3 years ago | 1

| accepted

Answered
Minimize the Sum of Square error using optimization
I think you can do the whole optimization analytically. In particular, rewrite E as, where A and B...

3 years ago | 0

Answered
How to compare the the values of a 3-d dimensional array
n=find( 6000-100*t_span < E_lower,1); [~,kmin]=min(p(:,n,:),[],3);

3 years ago | 1

| accepted

Answered
How to Interpolate coordiantes and values of a surface plot
You can build a scatteredInterpolant object. Then you can interpolate anywhere you wish. load('mesh_coordinates.mat'); centr...

3 years ago | 0

Answered
Error in using lsqcurvefit with constrained parameters.
I think you can set the upper bounds equal to the lower bounds to fix the parameters as the OP in the previous post originally w...

3 years ago | 0

Answered
To find exponent in power law equation of the form y = ax^m + b
fminspleas downloadable from https://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas is especially appropriate...

3 years ago | 0

| accepted

Load more