Answered
How to use lsqnonlin command.
Please comment on my code. It's fine, but lsqcurvefit is often more convenient for curve fitting problems, e.g. if you want to ...

5 years ago | 0

Answered
Integer Values in a Quadratic Optimization Problem
You can use ga() instead of quadprog(), if you have the Global Optimization Toolbox.

5 years ago | 0

| accepted

Question


Why does copyobj() fail to copy over title fontsizes (and also colorbars and colormaps)?
I am attempting to copy a set of subplot axes from one figure to another with copyobj. Everything seems to copy over quite nicel...

5 years ago | 1 answer | 1

1

answer

Answered
How to add lower triangle of zeros/indent to each row, in a matrix?
B=[1 2 3 4 5 6 7 8 5 5 3 3 3 3 3 4 4 4 5 5 1 4 3 4 3 4 4 4 5 5 3 3 3 3 4 4 4 5 5 5]; [m,n]=size(B); result=spdiags(B,0:...

5 years ago | 1

| accepted

Answered
Why the result of SQP algorithm varies each time when we change the starting point xo?
We have no reason to think that your function has a unique global minimum, so non-uniqueness could be a reason. It is also possi...

5 years ago | 0

| accepted

Answered
Curve Fitting Power Function
The Curve Fitting Toolbox does have straightforward tools for that case, both GUI-based and programmatic, https://www.mathworks...

5 years ago | 0

Answered
Analytical hessian for large scale optimization in fmincon
Can fmincon efficiently handle a problem such as mine, or am I better off using a dedicated commercial solver? The only way to ...

5 years ago | 0

| accepted

Answered
Minimum distance between two objects
load('Bones') reg=regionprops(Image,'PixelList'); [D,I1] = pdist2(reg.PixelList,'euclidean','Smallest',1); [minDistance...

5 years ago | 2

| accepted

Answered
plotting results of lsqnonlin in a loop
Since you are curve fitting, lsqcurvefit will be more convenient, file='https://www.mathworks.com/matlabcentral/answers/uploade...

5 years ago | 0

Answered
Determinant of integer matrices
This might work, A = randi(10000,[9,10]); A(end+1,:) = randi(10,[1,9])*A; determinant=double(det(sym(A)))

5 years ago | 0

Answered
i want a randomly scramble of a divided image into 4 blocks
Using mat2tiles (which you must Download), Image=imresize(imread('saturn.png'), [256,256]); im=mat2tiles(Image,[128,128,inf]...

5 years ago | 1

Answered
Determinant of integer matrices
Since you know A is an integer matrix, can't you just do, d=round(det(A));

5 years ago | 0

Answered
Translation or copy of matrix in all directions
See repmat, https://www.mathworks.com/help/matlab/ref/repmat.html

5 years ago | 0

Answered
Fit rectangle to binary mask
See the FEX submission pgonCorners (which you must Download).

5 years ago | 0

| accepted

Answered
Curve fitting of growing measurement data set
This might help, https://www.mathworks.com/matlabcentral/fileexchange/24443-slm-shape-language-modeling

5 years ago | 0

| accepted

Answered
Splitting a matrix into two smaller matrices in a loop
z=[1;2;4;6;8;10]; for k=1:length(z) ind=z(k):z(k+1); test=My_Data(ind,:); train=MyData; trai...

5 years ago | 0

| accepted

Answered
lsqcurvefit with two functions and same vriables
No, the problem is that YY is not 8x2.

5 years ago | 1

| accepted

Answered
Brace indexing is not supported for variables of this type.
imageNames = {imgFile.name}

5 years ago | 1

| accepted

Answered
color area between two shapes
load(websave('t','https://www.mathworks.com/matlabcentral/answers/uploaded_files/592785/data.mat')) R = 10; C = [0. 0.] ; xc...

5 years ago | 0

| accepted

Answered
how to select proper parameters for "opt.StartPoint" ?
Assuming b is known, the log-model log(yData)=log(c) + a*(log(x)*sin(x*b)^2) is a linear model in a and log( c ). Therefore, i...

5 years ago | 0

Answered
Filling a 2D area between 3 curves (Hypocycloid)
%radius big (fix) circle R=4; %radius small (rolling) circle r=1; phi=linspace(0,360,1000)*pi/180; phi(end)=[]; %parame...

5 years ago | 1

| accepted

Answered
Elements of matrix after an equation
p = A(:, 1) .* A(:, 2); index=(abs(p)==norm(p,inf)) & p<0; a1=A(index,1); a2=A(index,2);

5 years ago | 0

| accepted

Answered
Quadratic programming with just one constraint
We may have to be given your input matrices to reproduce the problem, but since ones(1,d) is full row rank, there shouldn't have...

5 years ago | 0

| accepted

Answered
3D array of rotation matrices multiplied on 2D array of vectors
C=pagemtimes(A, reshape(B.',3,1,[]) ); C=reshape(C,3,[]).';

5 years ago | 1

Answered
vectorize a for loop
This should be pretty well optimized already, r=pdist([xc,yc]);

5 years ago | 1

| accepted

Answered
Function with one input and no outputs
printmsg("Hello World") function printmsg(msg) disp(msg) end

5 years ago | 2

| accepted

Answered
What is the sampling frequency after convolution?
I want to calculate the convolution of the two signals with conv If you want to convolve with conv() then the signals definitel...

5 years ago | 0

| accepted

Answered
detecting rectangle in real images
This works for the one given image. I would need more examples to see if it's a reliable solution. It uses the FEX contribution ...

5 years ago | 0

Answered
Plotting a 3d cone
the general cone generators like 'cylinder([0 1])' are not usable for me. I think they are. You just have to reposition the co...

5 years ago | 2

| accepted

Answered
Randomly remove percentage of values above mean in array
A = [set of values]; A_rem=A; index1 = find(A>mean(A)); N=numel(index1); index2 = index1( randi(N,1,round(0.2*N)) );...

5 years ago | 0

| accepted

Load more