Answered
Very small feasibility value but very large first-order optimality value
That can happen if your objective function or constraints are not continuously differentiable, e.g., fmincon(@(x)sqrt(abs(x)),1...

4 years ago | 0

Answered
Border detection out of regular shape
load data_points data0=data; shp=alphaShape(data,0.9); [~,V]=boundaryFacets(shp); shp=polyshape(V,'Simplify',true); ...

4 years ago | 1

| accepted

Answered
polynomial help, is it to simply just use polyfit? I cant figure it out, I don't use matlab regularly
Yes, you could do most of it with polyfit.

4 years ago | 0

Answered
Polygon Expansion within Bounding Box
You might be able to use polybuffer() or scale() to expand the polygons together with intersect() to detect illegal intersection...

4 years ago | 0

Answered
Draw polygon around grid points
small_dots = [2.1250 52.6250 2.1250 52.8750 2.1250 53.1250 2.3750 52.3750 2.3750 52.6250 2.37...

4 years ago | 0

| accepted

Answered
Multiplying each column with a corresponding row value
A= [ 1 2 3 4 5] B= [1 2 3 4 5; 6 7 8 9 10; 1 1 2 3 1] C= A.*B

4 years ago | 0

| accepted

Answered
fzero solver within a for loop stops working at a certain step
I am not sure why you are using fzero. It looks like the root can be solved explicitly for x2. In any case, you can more easil...

4 years ago | 0

Answered
How would I prevent access to classes that shouldn't be publicly available in my toolkit?
You cannot truly hide the class, but you can have its constructor raise an error when someone tries to invoke it from outside yo...

4 years ago | 0

Answered
Dot product of tensor
Ar=reshape(A,[],3); Br=reshape(B,[],3); C=reshape( Ar*Br.' ,ma,na,mb,nb);

4 years ago | 0

Answered
tall array within a parfor?
You've generated idx in a way that doesn't have a simple dependence on the loop variable. This warning is not present if you are...

4 years ago | 1

| accepted

Poll


When I receive error messages in MATLAB, I understand them

4 years ago | 806 votes | 2 comments

Answered
Eigenvalue problem on non-Hermitian matrix
You said it yourself - the matrix is not Hermitian so there is no reason to expect inv(V)=W'. There is no reason even to expect ...

4 years ago | 0

Answered
Zero Pad My FFT Signal and Window
The zero-padding is fine. The way you set up your frequency axis, I'm a little unsure about. N=numel(FTSignal); NormalizedAx...

4 years ago | 0

Answered
How to resize a specific part of an image?
One way would be to perform an erosion using bwlerode (downloadable from here) load Image B=bwlerode(A,3,strel('disk',8)); ...

4 years ago | 0

Answered
Ax = 0 with 2 values of x known
b=-A(:,[1,end])*[xInitial;xFinal]; x=A(:,2:end-1)\b; x=[xInitial, x', xFinal]';

4 years ago | 0

Answered
Fitting a fourth order polynomial
You can use bounds to force the unwanted coefficients to zero. lb=[-inf,0,0,0,-inf]; fitobject = fit(x,y, 'poly4','Lower',l...

4 years ago | 0

| accepted

Answered
lsqnonlin data plotting and verification
If you use lsqcurvefit instead of lsqnonlin, any of the examples here, https://www.mathworks.com/help/optim/ug/lsqcurvefit.html...

4 years ago | 0

Poll


What is your main tool or approach for debugging MATLAB code?

4 years ago | 2506 votes | 10 comments

Answered
Problem with Linear inequality constraints
sum(over j)(xij)<=1 for each i This constraint can be written, x=rand(36); [m,n]=size(x); A=kron(ones(1,n),speye(m)); b=o...

4 years ago | 0

| accepted

Answered
How do you include a figure caption below a graph?
With the text() command you can position text anywhere in or around the axes that you wish.

4 years ago | 0

Answered
Regarding the differentiation of function
x = -10:0.1:10; y = [1 6 0.03 0.08 10]'; A = 23 * (atan((0.005 + y)./x.^2)); B = diff(A,1,2)/0.1; plot(x(1:end-1),B')

4 years ago | 0

| accepted

Answered
How can I trace x, y point of boundary of an image? I need co-ordinate point of the inner and outer boundary only.
bwboundaries does exactly what you're asking for. A=imbinarize( rgb2gray(imread('Image1.png')) ); B=bwboundaries(A); imsh...

4 years ago | 1

| accepted

Submitted


Intersections of multiple 2D lines or line segments
Compute the intersection of a reference line (or line segment) with a polyshape boundary or with a batch of other line segments....

4 years ago | 252 downloads |

4.0 / 5
Thumbnail

Answered
Finding intersection point for polygon with hole
By the way I am trying to find intersection points so that I can discretisize the boundry with additional nodes with linspace fu...

4 years ago | 0

Answered
Error in fsolve function
a=solve(M)

4 years ago | 0

| accepted

Question


Is cell2mat supposed to support non-plaid cell partitioning? If not, why not?
I have 2 cell arrays, load C; C,Ct Why does cell2mat work on one, cell2mat(C) but not the other? cell2mat(Ct) I understand...

4 years ago | 2 answers | 0

2

answers

Answered
Compare cells in cell array to find common columns
You should just use an explicit loop over all combinations of cells. With cell arrays, there is never a good reason to look for ...

4 years ago | 0

| accepted

Answered
How to solve this complicated expression to get real roots?
Based on the plot, the minimum value of the expression would lie somewhere between -0.005 and 0.008, so using fminbnd(), [x,fva...

4 years ago | 0

| accepted

Answered
How to Find Correct Vertice formation for polyxpoly function
Instead of polyxpoly, I would recommend downloading linexlines2D(), https://www.mathworks.com/matlabcentral/fileexchange/93470-...

4 years ago | 1

| accepted

Load more