Answered
How can i find solid cone center of mass?
https://byjus.com/jee/centre-of-mass-of-a-solid-cone/

3 years ago | 1

Answered
256x256x6 exp decaying data
I feel like there is a lot of missing detail in the question, but here is one fulfillment of what it asks for: out = exp(-sort(...

3 years ago | 0

Answered
solving nonlinear equation including max function
Reorganizing the equations into the form A*x<=b, Aeq*x=beq and using this FEX download, https://www.mathworks.com/matlabcentral...

3 years ago | 0

Answered
Centre X-Y data so that the highest value of Ys is at the centre of X. And then average the curve to fit into gaussian.
Using gaussfitn from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/69116-gaussfitn you can do a sim...

3 years ago | 0

| accepted

Answered
Centre X-Y data so that the highest value of Ys is at the centre of X. And then average the curve to fit into gaussian.
I think it would be better just to fit a gaussian (e.g. using fit) to each pair (X,Y(:,i)). Then the fitted mean in each column ...

3 years ago | 0

Answered
Call on function that takes in 2 variables multiple times
You can hide the loop with arrayfun, but it won't speed things up. output_vectors = cell2mat(arrayfun(@(i) {example_func(input_...

3 years ago | 0

| accepted

Answered
Function lsqlin smooth results
You could add smoothing penalties on first differences to your lsqlin data. Assuming your signal is of length n, this would look...

3 years ago | 1

| accepted

Answered
inpolygon usage with big matrices or faster function
Is it a convex polygon? There are much faster alternatives to inpolygon for convex polygons,e.g., https://www.mathworks.com/mat...

3 years ago | 0

Answered
How to seperate the circle object from the background.
A=double(load('Image').A); B=rgb2hsv(A); C=bwareafilt(imbinarize(B(:,:,2)),1); mask=imclose(C,strel('disk',15)); imshow(ma...

3 years ago | 0

Answered
Linear indexing over a subset of dimensions
If you are indexing into the initial dimensions of an array, reshape will be cheaper than permute: B = zeros([25 3]); bIdx = [...

3 years ago | 1

| accepted

Answered
Array indices must be positive integers or logical values. in line 5
Correct the missing space in, fori=1:n;

3 years ago | 0

Answered
2 vectors compare it
I will assume here that the oddity mentioned above by @Dyuman Joshi is an error in the presentation of the example. A=[2 3 4...

3 years ago | 0

| accepted

Answered
Build Matrix from X and Y Coords and Corresponding Values
Generally speaking, if you have a list of (t,f) coordinates with corresponding values a, you can use accumarray, e.g., t=[1,2,3...

3 years ago | 0

| accepted

Answered
Test of whether matrix is Symmetric Positive Definite is giving wrong result when matrix is not symmetric
But when I tried to check if Sk is symmetic positive definite using the method described here in the documentaion: All of the t...

3 years ago | 0

Answered
How to rank 3d matrix across 2 dimensions
Is this (simplified) not what you want? iVars=rand(3,3,5); iNames = {'Var 1','Var 2','Var 3','Var 4','Var 5'}; [~,VarSORT]=...

3 years ago | 0

Answered
Set methods for two interdependent properties in class: how do I avoid infinite recursion?
Here's a possible solution with both properties Dependent. It will avoid the infinite recursion, but as I said above, it's not c...

3 years ago | 0

| accepted

Answered
Split big matrix in many submatrices having same size
What I'm trying to do is to split the matrix to submatrices and then for each submatrix, calculate the median value and store th...

3 years ago | 0

Answered
How can I find the mean of multiple variables in for loop
For example, Arrays={rand(2), rand(3), eye(10), randn(15)} Means=cellfun(@(z)mean(z,'all') , Arrays)

3 years ago | 0

Answered
fminunc : A VERY STRANGE PROBLEM!
If I had to guess, the GPU cannot achieve faster speeds because fminunc requires that you pull the results of GPU computation ba...

3 years ago | 0

| accepted

Answered
Change exact area in binary images from 1 to 0
load BW hole = bwareafilt(~BW,1,'smallest') ; BW=BW& ~imdilate(hole,strel('disk',5)); imshow(BW)

3 years ago | 0

| accepted

Answered
Question of Comparing two vectors
a(a<0 | a>1)=nan; b(b<0 | b>1)=nan; c=max(a,b);

3 years ago | 0

| accepted

Answered
Scaling an image then overlaying data on top of it
[X,Y]=readvars('Center of Pressure Data.xlsx'); Y=-Y; h=imshow(flipud(imread('Overhead View of Human.jpg')),[]); h.XData=[4...

3 years ago | 0

| accepted

Answered
help using matlab solve ga function for optimization of non linear expression
See, Optimize with Nonlinear Constraints Using GA. It should look something like this: x=linspace(0,100,10000); vars = ga(f...

3 years ago | 0

Answered
Best way to speed up (parallelize) a large function that take three large 3D arrays as input
I think you need to extract the local part, like in the following: XI1 = distributed(xi1); XI2 = distributed(xi2); XI3 = dist...

3 years ago | 0

Answered
Assign value to individual components of the complex number
H=complex(10,imag(H)) H=complex(real(H),10)

3 years ago | 1

Answered
Skeletonize 3d cylinders
The key problem is that some of the cylinders are touching other cylinders. For those that don't, we can easily separate them wi...

3 years ago | 1

Answered
How to identify if a string has a pattern ?
And finally, is the a way to simplify a string that has several multiplications inside? If you have the Symbolic Math Toolbox ...

3 years ago | 0

Answered
sort a matrix in a specific way
A = [0.1 0; 0.5 0; 1 0.3; 1 0.7; 0.6 1; 0.1 1; 0 0.9; 0 0.2]; %second matrix ...

3 years ago | 0

Answered
sort a matrix in a specific way
%first matrix A = [0.1 0; 0.5 0; 1 0.3; 1 0.7; 0.6 1; 0.1 1; 0 0.9; 0 0.2]; %...

4 years ago | 0

| accepted

Answered
How do I express optimization variable as ones and zeros in constraints?
You would need to introduce additional binary variables Z: X=optimvar('X',24,4,'Lower',0,'Upper',5,'type','integer'); %origina...

4 years ago | 0

| accepted

Load more