Answered
I can't get a final constraint with fmincon
I strongly suspect that it is possible.

5 years ago | 0

Answered
indexing of discrepancy between matrices
S1 = [0 1 0 2 4 3 1] ; S2 = [1 1 0 4 4 3 0]; S3 = [0 2 0 4 4 1 1] ; Q=sum(~[S1;S2;S3]); logical2=Q==1 | Q==2 Q=find(abs...

5 years ago | 0

Answered
How do I find the zero crossings for a function sinx/x against x?
You can see analytically that the zeros will occur when the numerator sin(x) has a zero crossing, which will occur at non-zero i...

5 years ago | 0

Answered
Plot x values corresponding to n max y values in a table
i am unable to get matlab to find the corresponding x values. It's unclear how you've been approaching it, but if you are usi...

5 years ago | 0

| accepted

Answered
finding a solver in matlab to solve an equation
Well, you could plot the function to get an idea where to make your initial guess. To me, though, it doesn't look like it has an...

5 years ago | 0

Answered
How can I perform multivariable polynomial curve fitting?
polyfitn is pretty popular: https://www.mathworks.com/matlabcentral/fileexchange/34765-polyfitn?s_tid=srchtitle

5 years ago | 0

Answered
find sum of the run length of non zero elements between zeros of a matrix
Using this File Exchange submission https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive...

5 years ago | 0

Answered
Intersecting and non-intersecting box regions
Using rectint(), you can straightforwardly obtain a binary mask A such that A(i,j)=1 if rectangle bbx(i,:) and bbx(j,:) intersec...

5 years ago | 1

| accepted

Answered
Polyshape/union returns incorrect polygon shape
Like Scott, I find the result doesn't reproduce (R2020b). I strongly suspect what you're seeing might be the same as this acknow...

5 years ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
Since x is not an integer, you cannot use it to look up an entry in a vector X_s(x). Perhaps the following is what you really wa...

5 years ago | 2

| accepted

Answered
Create vectors that allow to subdivide the pixels of an image
[m,n]=size(img); y=linspace(0,m,5*m+1).'+0.1; y(end)=[]; x=linspace(0,n,5*n+1).'+0.1; x(end)=[];

5 years ago | 0

| accepted

Answered
how to count no of zeros between ones
Using the tools in this FEX submission, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecu...

5 years ago | 0

Answered
Multiply a cell array with a matrix in an equation
Your code gives me no errors, but make sure you pre-allocate an empty cell array for eqn: eqn=cell(4); for i=1:4 for j=1:...

5 years ago | 1

| accepted

Answered
If then on column based upon number
Perhaps this is what you want, mean(B(A>=2 & A<=4))

5 years ago | 0

| accepted

Answered
how can i find x value from given y (6th degree polynomial)
x=roots([p1,p2,p3,p4,p5,p6,p7-y])

5 years ago | 1

| accepted

Answered
How to Optimize the expression graphical
Seems like something that fmincon() could do quite easily.

5 years ago | 0

Answered
function assignin overwrites my data
Do not return a result to the base workspace in each pass through the loop. At the completion of your loop, you should have accu...

5 years ago | 1

| accepted

Answered
I'm trying to have a vector of alternatinating 1 and 2 that correspond to another vector of min and max values and time
Here's an alternative solution, also using the tools at https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-pr...

5 years ago | 0

Answered
how can i find the center of the 3 circles in this plot?
A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/678708/Screen%20Shot%202021-07-08%20at%205.37.33%20PM.p...

5 years ago | 0

| accepted

Answered
Rotate signal around midpoint
If the red curve and blue curve consist of corresponding point pairs, then you can use absor, https://www.mathworks.com/matlabc...

5 years ago | 0

Answered
How can assign value to a field of structure?
[A(1:5).B]=deal(1)

5 years ago | 0

Answered
manually-written floor function code for rounding non-integers
If floor (2.3) = 2. I want to see a mathematical expression that grabs 2 and/or discards 0.3 to output 2. There is no fundame...

5 years ago | 1

Answered
Find a 4-point polygon enclosing scattered points
k=convhull(x,y); xc=x(k); yc=y(k); %corners

5 years ago | 0

Answered
How to visualize catenoid surface using matlab?
Here is a very similar example from the documentation for the cylinder() command t = 0:pi/10:2*pi; r = 2 + cos(t); [X,Y,Z] = ...

5 years ago | 0

Answered
Create polygon with more contour points (not only vertices)
r = 0.6327/cosd(30); theta = 0:60:360; x = r*cosd(theta); y = r*sind(theta); t=linspace(0,1,10).'; t(end)=[]; x=t*x+(1-t)...

5 years ago | 0

| accepted

Answered
Im not sure how to resolve this issue
Most likely you have a spelling mistake in the name of the component.

5 years ago | 0

| accepted

Answered
Merging and adding two coulmn vectors in a specific way
b = [0;1;0;1;1;3;1;2;0;1]; c = [0.25; 0.21; 0.33; 0.22;0.24]; q=double(b==1); q(logical(q))=c; output=cumsum(q)

5 years ago | 0

| accepted

Answered
How to quickly calculate the sum of the transpose of a sparse matrix?
Depening on the size of selectedCols, it may also help to cast the operation as a matrix/vector multiplication A=sprand(1e6,1e5...

5 years ago | 0

Answered
How do I combine 2 arrays into one but in a specific order.
temp_odd = [9.6 7.7 6.0 4.3 8.9 10.2 10.6 10.7 8.6 8.0 7.1 7.5]; temp_even = [9.2 9.0 6.8 5.9 7.2 9.2 10.9 10.6 10.3 8.2 8.8 7....

5 years ago | 0

| accepted

Answered
How to quickly calculate the sum of the transpose of a sparse matrix?
A=sprand(1e6,1e3,100/1e6); %Example selectedCol=1:2:100; tic; B=sum( A(:,selectedCol)'); toc tic B=sum( A(:,selecte...

5 years ago | 1

Load more