Answered
which function should I use to get a relationship among x,y and extra parameter?
lsqnonlin would be worth a try. https://www.mathworks.com/help/optim/ug/lsqnonlin.html

5 years ago | 0

Answered
Matrix with function handle: how to evaluate for a vector
Write J so that it has single argument syntax, J = @(xyz) [2*exp(2*xyz(1)),0,-cos(xyz(1));-1,1,0;0,2*xyz(3),1]; X=[1;1;1]...

5 years ago | 1

| accepted

Answered
Calculating coordinates of points in grid from image
Seems like easy work for regionprops, load Image image=~imbinarize(image); T=regionprops('table',image,'Centroid'); ...

5 years ago | 0

| accepted

Answered
Rows and Columns manipulation
fn=@(z) floor(z*100)/100; B=fn(B); C=fn(C); [~,index]=ismember(B, C); index=nonzeros(index); D={C(index), index}; ...

5 years ago | 0

| accepted

Answered
Missing functions for Image Processing
The same installation .exe that you used to install Matlab should have an option to install the Image Processing Toolbox, if you...

5 years ago | 0

Answered
Dividing two vectors of different sizes
Yep. Just use deconv. deconv([1,2,1],[1,1])

5 years ago | 0

| accepted

Answered
Finding connected pixels of an object from a starting pixel in a gray scale image
You could apply bwdist to find all pixels that are within some distance of the seed pixels, and bwdistgeodesic if you want to co...

5 years ago | 1

Answered
Finding connected pixels of an object from a starting pixel in a gray scale image
Once you threshold the image (making it binary) you can use regionprops or bwconncomp.

5 years ago | 1

Answered
Inside a circle with random mesh points
One way, N=3e3; %number of points R=3; %radius r=R*rand(N,1); theta=2*pi*rand(N,1); X=r.*cos(theta); Y=r.*sin(theta...

5 years ago | 1

| accepted

Answered
Fitting multiple Gaussian curves to data with multiple peaks
This may be applicable, https://www.mathworks.com/help/curvefit/gaussian.html

5 years ago | 0

| accepted

Answered
multiplication table using for loops
for i=1:5 i*(1:i) end

5 years ago | 0

Answered
'n' number of nested for loops
[c{1:n}]=ndgrid(1:8); c=reshape(cat(n+1,c{:}) [],n); K=size(c,1); Q=cell(n,1); for i=1:n Q{i}=reshape(M{i}( c(:,...

5 years ago | 0

| accepted

Answered
Initial guess does not change in MATLAB fitting tool
The order of magnitude of your Y-Data is (~1e-5) is close to the default TolFun stopping parameter. This makes the algorithm p...

5 years ago | 1

| accepted

Answered
fft2 and ifft2 don't return my original image, even with no transformations
Convert the image to double floats before you start taking FFTs. Also, be mindful that your image has RGB color channels. Did ...

5 years ago | 0

Answered
Using genetic algorithm to minimize standard deviation
The fitnesfcn will be called only on those population members that satisfy your constraints. That is undoubtedly why you are see...

5 years ago | 0

| accepted

Answered
3D interpolation using griddedInterpolant to train the interpolation function F with Spline method
Your data is not gridded, as can be seen from, [x,y,v]=readvars(websave('data','https://www.mathworks.com/matlabcentral/answers...

5 years ago | 0

| accepted

Answered
Is there a way to run many anonymous functions simultaneously?
If you have the Parallel Computing Toolbox, you can use parFeval, https://www.mathworks.com/help/parallel-computing/parallel.po...

5 years ago | 1

| accepted

Answered
How to average data within bins when values are not integers?
numBins=10; bins=discretize(new_u10wcav,numBins); meany=splitapply(@mean,wc_average(:),findgroups(bins(:)));

5 years ago | 0

Answered
Pulling values from vectors
but what does income(i) imply? I'm under the assumption that it needs to be used here Nope. It doesn't: income = initial_incom...

5 years ago | 0

| accepted

Answered
Rotation Matrix Function Issues
Change for to if: function R = AxisAngle_to_Rot(axis, angle) if isequal(axis, [1; 0; 0]) R = [1 0 0; 0 cos(angle) ...

5 years ago | 2

Answered
How do I plot a function of one variable easily in matlab?
Use element-wise multiplication and division operators: e = 8.85*10^-12; c = 3*10^8; a = 0.02286; u = 4*pi*10^-7; f = 8*1...

5 years ago | 1

Answered
How to plot a swarm chart with no specific x-values?
This Github offering has worked pretty well for me: https://github.com/bastibe/Violinplot-Matlab

5 years ago | 0

Answered
find row and column in 10 by 2 matrix that contain a particular row element
rows = ( data(:,1)==6 & data(:,2)==2 )

5 years ago | 2

| accepted

Question


Understanding implicit surface plot behavior
Here is some code that plots an implicit infinite, tilted cylinder. Q=diag([0,1,1]./3^2); axis([-5 5 -5 5 -5 5]) h1=fimpl...

5 years ago | 2 answers | 3

2

answers

Answered
Hatch pattern inside connected components in a binary image
Perhaps as follows, load Regions [m,n]=size(BW); N=7; %controls hatch density hatch = ( mod((1:m).'+ (1:n),N) == (N-1)...

5 years ago | 0

Answered
Is there any way to define a loss function in optimization problems?
Yes, absolutely. Without a function to optimize, it's not an optimization problem.

5 years ago | 0

Answered
Function e^x - e^-x / e^x + e^-x
For example, x=linspace(-5,5,100); plot(x,tanh(x))

5 years ago | 0

| accepted

Answered
How to plot a curve tangent to many ellipses.
You could also try, P =[X Y]; P = unique(P,'row'); k=convhull(P); Xh=P(k,1); Yh=P(k,2); line(Xh,Yh)

5 years ago | 1

| accepted

Answered
minimum value optimization with constraints
Use the constraints to eliminate x2 and x3 from f, f=(x1+1)^2/4 - 2*x1 Now, you just have to minimize a 1D quadratic function ...

5 years ago | 0

Load more