Answered
I can't click on figures to interact with them and open new figures
You could also try disableDefaultInteractivity.

4 years ago | 1

Answered
I can't click on figures to interact with them and open new figures
if ~verLessThan('matlab','9.5') set(groot,'defaultFigureCreateFcn',@(fig, ~)addToolbarExplorationButtons(fig)); ...

4 years ago | 1

| accepted

Answered
How to do vector projection?
In 2D Euclidean space, to project a point P=[x,y] onto a straight line, you need (1) a point on the line P0=[x0,y0] (2) a di...

4 years ago | 0

| accepted

Answered
Double parameter optimisation using optimisation toolbox
In this is my xdata P1 and ydata P2? xdata, ydata are what you call experimtalX and experimentalY. The unknown parameters that ...

4 years ago | 0

| accepted

Answered
fmincon lower bound interval
You cannot specify a partially discrete constraint like "x(i)=0 or x(i)>=0.1" on your variables with fmincon. To handle that w...

4 years ago | 0

| accepted

Answered
finding nonzero values in 4 matrixes which have the same indices
b=(ozone70>0 & ozone80>0 & ozone90>0 & ozone2000>0); areas=Areas(b); o70= ozone70(b); weightedMean=dot(areas/sum(areas),o...

4 years ago | 0

Answered
How to save each resultant matrix from a for loop
One way no_nodes = 5; A = 8; E = 1.9e6; L = 36; k = A*E/L; th = [0,pi/4,pi/2,3/4*pi]; K=cell(1,4); for i = 1:4 ...

4 years ago | 0

| accepted

Answered
Image detect and convert white image
A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015940/image.png'); imshow(any(250-A,3))

4 years ago | 0

Answered
fmincon does not produce similar result due to automatic scaling?
With such a general description, only general things can be said. However, here are some remarks: What's more, what I tried is ...

4 years ago | 0

| accepted

Answered
Optimizer (fminsearch) doesn't work as expected
It appears that you have 21 unknown variables. That is too many. fminsearch is only guaranteed to converge theoretically for one...

4 years ago | 1

| accepted

Answered
Vector as an input in function
That should have worked. func([1,2]) function func(v) a=v(1), b=v(2), end

4 years ago | 0

| accepted

Answered
How to find the eigenvector associated with the highest eigenvalues.
No, the output of eig() is not sorted, but the output of svd() is.

4 years ago | 1

| accepted

Answered
Create and lock a struct with fields in a class
One way: classdef myclass properties x = struct('a',0,'b',1); end methods function obj...

4 years ago | 0

Answered
How to optimize an objective function with strict inequality constraints?
The original problem with the unnecessary 240 term dropped is, Objective function =-70*x1-10*x2 subjected to : 3<=x(1)...

4 years ago | 0

| accepted

Answered
calculating the mean for each column in a numerical array based on the elements in column 1
Let's call your matrix A. Then, out = splitapply(@(z) mean(z,1),A,A(:,1));

4 years ago | 2

Answered
Optimization when solving equation system
fmincon with a nonlinear constraint would probably work, although because your constraint is non-differentiable, strictly speaki...

4 years ago | 0

Answered
Setting up linear optimization problem
X=rand(100,1); Y=rand(100,1); timeit(@()doOptimization(X,Y)) function doOptimization(X,Y) fun=@(M)objective(M,...

4 years ago | 0

| accepted

Answered
Why is x(:) so much slower than reshape(x,N,1) with complex arrays?
I was just told by Tech Support that the issue was fixed in R2022a, but it doesn't appear that way: Nx = 256; Ny = 256; Nz = ...

4 years ago | 0

Submitted


Absolute Orientation - Horn's method
Solves weighted absolute orientation problem using Horn's quaternion-based method.

4 years ago | 9450 downloads |

4.9 / 5

Answered
How to do quadratic interpolation in two dimensions on a plane
I realize the interp2 is a linear interpolation technique No, you have several alternatives to linear interpolation with inter...

4 years ago | 0

| accepted

Answered
How to loop through each row of a column, then loop through the remaining columns?
If your group1_responses is a cell or string array, there is no need to distinguish between rows and columns at all. Just do, g...

4 years ago | 1

Answered
Problem in defining the fit type function for curve fitting tool
fittype( @(nu,numGaussians,a,sigma) SCR(nu,numGaussians,a,sigma),'independent','nu')

4 years ago | 1

Answered
What is the recommended way to pass long list of parameters between main workspace and function?
In the case of your posted example, the appropriate re-implementation would be, a=1:5; result=calcvalues(a); function accum...

4 years ago | 0

Answered
Update multiple values in a struct array
You can do it in 2 lines, C=num2cell([S.value]+5); [S.value]=deal(C{:})

4 years ago | 0

Answered
Update multiple values in a struct array
No, but easy enough to make one: [s(1:2).f]=deal(1,2); s.f s=incremStruct(s,'f',5); s.f function S=incremStruct(S,field...

4 years ago | 0

| accepted

Answered
how does the xcorr fun works and what is the difference between corr and xcorr?
What xcorr is computing is described here, https://www.mathworks.com/help/matlab/ref/xcorr.html#mw_ff426c84-793b-4341-86f0-077e...

4 years ago | 0

Answered
how to plot only non zero value of a slicing of a 3d matrix?
a(~a)=nan; plot(a(:,:))

4 years ago | 0

| accepted

Answered
Cosine similarity between two matrices
I tend to prefer pdist2, UV=[U(:),V(:)]; D=1-pdist2(UV,UV,'cosine')

4 years ago | 0

| accepted

Answered
Constrained optimization of a vector
You have two equations so, as long as numel(a)=2 and f1 and f2 are differentiable, you can use fsolve. If numel(a)>2 then you ha...

4 years ago | 0

Answered
Fourier transform of a rectangular pulse
It's always good to decide on both your time and frequency sampling axes first, before doing any FFT processing. For a pulse wid...

4 years ago | 0

Load more