Answered
Is it possible to (non-linear) minimize x^y by choosing both x and y?
w = optimvar('w','Lower',log(1.01),'Upper',log(100)); %w=log(x) z= optimvar('z','Lower',sqrt(1.01),'Upper',sqrt(2)); %z=sqrt(y...

4 years ago | 0

Answered
Find out whether a 2D line (y = a*x + b) intersects with a square without using "solve" (I need something faster)
Sort of like William's, but faster for some reason: % example line parameters: a = 1.61; b = -3.1; % example square paramet...

4 years ago | 2

| accepted

Answered
Find out whether a 2D line (y = a*x + b) intersects with a square without using "solve" (I need something faster)
Using linexlines2D, https://www.mathworks.com/matlabcentral/fileexchange/93470-intersections-of-multiple-2d-lines-or-line-segme...

4 years ago | 2

Answered
How to interpolate a cloud of points?
I've no way of testing this without your row/column data, but: [rows, columns, count_there] = find(store == max(store)); [...

4 years ago | 0

| accepted

Answered
Filling specific holes in an image without changing edges
k=[1 1 1; 1 0 1; 1 1 1]; mask=conv2(YourImage,k,'same')>threshold; YourImage=regionfill(YourImage,mask);

4 years ago | 0

Answered
How to have x-axis go from 0 to 1 back to 0
You can use xticklabels() to put anything you want on the x-axis.

4 years ago | 0

| accepted

Answered
How can I save the last iteration of estimated model parameters (using an optimizer) before timing out?
Some relevant reading https://www.mathworks.com/help/matlab/math/output-functions.html https://www.mathworks.com/help/matlab/m...

4 years ago | 0

Answered
Boundary detection, somewhat like bwperim, but for a binary vector?
Download this, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vecto...

4 years ago | 1

| accepted

Answered
How to apply linear least squares fit for two entities?
You can do a total least squares fit using linear2dFit() from, https://www.mathworks.com/matlabcentral/fileexchange/87584-objec...

4 years ago | 0

| accepted

Answered
Opposite coordinate in the image
Use linexlines2D, to be downloaded from, https://www.mathworks.com/matlabcentral/fileexchange/93470-intersections-of-multiple-2...

4 years ago | 0

Answered
How to code "e" by itself in equation e-1?
e=exp(+1)

4 years ago | 0

| accepted

Answered
Convert polynomial operations inputs in double vector as output
converter('2*s^2 + s +1') converter( 's*(s+1)*(s+5)' ) converter('(s+2)*(s+3)^2') function p=converter(str) fn=str2func...

4 years ago | 1

| accepted

Answered
Find value of signal A at a given value of signal B (twice for every cycle)?
Download this, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vecto...

4 years ago | 0

Answered
What's the best way to solve this implicit equation?
Use fzero

4 years ago | 0

Answered
Setting min and max values
data = cell2table(data); max_col567 = max(data{:,5:7},[],'all'); min_col567 = min(data{:,5:7},[],'all'); fmt=fillmissin...

4 years ago | 0

| accepted

Answered
What motivates you to contribute on Matlab Answers?
I find it a good way to see what other people are working on, and what's prominent in STEM fields in general. I also find it a ...

4 years ago | 1

Answered
How to draw irregular curve using random data ?
t=pi/180*(0:10:360); r=5+0.5*(rand(size(t))*2-1); r(end)=r(1); tq=linspace(t(1),t(end),1000); rq=spline(t,[0,r,0],tq); ...

4 years ago | 0

| accepted

Answered
GA is suddenly much slower (no other visible effects)
As a troubleshooting strategy, I suggest putting a tic...toc as the first and last lines of the fitness function. This way you c...

4 years ago | 0

| accepted

Answered
Exclude rows from table if multiple conditions are met
A=randi(5,5); A(A<=4)=nan A(all(isnan(A),2),:)=[]

4 years ago | 0

Answered
Finding common elements in an array (even if they are not in the same position)
a=1:10 b=[1,11] c=intersect(a,b)

4 years ago | 0

| accepted

Answered
How to improve this function execution?
Since the code provides many calls of this function Instead of calling the function multiple times, call it just one time or ju...

4 years ago | 0

Answered
How do you rotate an ellispoid?
Use rotate.

4 years ago | 1

Answered
Reduce memory use when doing element-wise multiplication of repeated (repmat/repelem) matrices? (Final product is more sparse than intermediate computations.)
or , where F is ones(1,s3), D is ones(s1,s2), and E is ones(s4), This solution eliminates the need to form the Kronecker produc...

4 years ago | 0

Answered
extract control points of curve with spline
But, nobody wants to extract minimum number of control points out of a given curve!!! There is no minimum number unless the gi...

4 years ago | 0

Answered
How to perform linear curve fitting based on distance from line instead of residuals
You can use linear2dFit() from this FEX package, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-too...

4 years ago | 0

Answered
Comparing indices in columns of a matrix
matrix=randi(5,5,10); %Example input [m,n]=size(matrix); LUT=1:n; out=cell(m,1); for i=1:m G=findgroups(matrix...

4 years ago | 0

| accepted

Answered
Using static classes over packages
I don't think static classes have any pitfalls, but I'm not sure I agree that it is "cleaner". Why is having 10 functions in a f...

4 years ago | 1

| accepted

Answered
Fitting a straight line to scattered portion of data and then extrapolation straight line to intersect x axis
You don't need to drag the line to find the x-intercept. Just use roots, p=polyfit(x,y,1); xIntercept=roots(p); or even jus...

4 years ago | 0

| accepted

Answered
Mean of matrix elements that have same value in the first column
dmRe_40=varfun(@mean,array2table(dmRe_40),'Grouping',1); dmRe_40=table2array(dmRe_40(:,[1,3:end]));

4 years ago | 0

| accepted

Load more