Answered
Problems while trying to fit a 4-variable function with lsqcurvefit
voigt_func =@(x,xdata) x(1).*(2.*log(2)./pi.^(3./2)).*(x(2)./x(3).^2)... .*integral(@(t) (exp(-t.^2))./((sqrt(log(2)).*(...

4 years ago | 0

| accepted

Answered
What is the best way set the search interval used by fminbnd?
Your minimization problem is really a root-finding problem in disguise. It is better to use fzero for such things. As you can se...

4 years ago | 0

| accepted

Answered
What is the best way set the search interval used by fminbnd?
and I have had to "cheat" by setting the search interval to something that more tightly bounds the known correct answers for my ...

4 years ago | 0

Answered
Finding close-to-linear solution
Pre-transpose c before the optimization to avoid repeatng the tranpose every iteration. ct=c'; function outer(p,ct) E0 = ...

4 years ago | 0

| accepted

Answered
I am trying to use the function fmincon for multiple nonlinear inequality constraints, and the output given does not satisfy all the inequality constraint
As a general rule, you should avoid nonlinear constraints when they have a linear equivalent. In your case, the nonlinear constr...

4 years ago | 0

Answered
Vectorize loop to speed up
The operations look like IFFTs, though possibly you have irregular time and frequency sampling. Even so, you should possibly co...

4 years ago | 0

Answered
Vectorize loop to speed up
Fcell=cellfun(@(x)x(:),FFT,'uni',0); Fmat=cell2mat(Fcell(:)'); Tau=cellfun(@(x)x(:)',tau,'uni',0); Tmat=cell2mat(Tau(:)); ...

4 years ago | 0

Answered
Rotate the coordinate system to align an existing plane with Y'Z' plane
If you didn't obtain your plane fit with planarFit() from, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-or...

4 years ago | 0

Answered
If one normalized vector is subtracted from another normalized vector, is it necessary to normalize the result?
If , it does not necessarily follows that . Example: a=rand(1,5); a=a/norm(a); b=rand(1,5); b=b/norm(b); norm(a-b)

4 years ago | 0

Answered
fsolve within fsolve -> update initial guess
function F = solvep(p,x0,par) persistent X0 if isempty(X0), X0=x0; end % some calculations x = fsolve(@(x) solvex(x...

4 years ago | 0

| accepted

Answered
Error using polyfit (line 44) The first two inputs must have the same number of elements
The error message has given you a big clue to where the problem is. Did you examine/verify the contents of I and fct to see if t...

4 years ago | 0

Answered
How to measure and show the center to center distance between lines at intersecting points
VDists=hypot( diff(XCrossings,1,1), diff(YCrossings,1,1)); HDists=hypot( diff(XCrossings,1,2), diff(YCrossings,1,2)); xlocs=...

4 years ago | 1

| accepted

Answered
How to formulate 2D frames if I have the origin of the frames (x, y) and the inclination angle of the frame with respect to the x-axis?
T=makehgtform('translate',[x,y,0],... 'zrotate',angleDegrees*pi/180, ... 'translate',[-x0,-y0,0]);...

4 years ago | 1

| accepted

Answered
How to get the value from Structure array ?
I want to use the centroid location in this image to crop another image then save the cropped area to separate file. I=imread(...

4 years ago | 0

Answered
arg max data type
No, but can't you just cast it to an integer type post-facto? E.g., ix=cast(ix,'uint32');

4 years ago | 0

| accepted

Answered
how can i obtain the paraconjugate of a polynomial of any degree ?
poly( conj( roots(p) ) )

4 years ago | 0

Answered
Create new matrices based on the number of unique values
M = [4 7 2; 2 4 7; 2 2 4]; x=reshape(unique(M),1,1,[]); output=(M==x)

4 years ago | 1

Answered
How can I combine two images to form an image like this?
Perhaps with this? https://www.mathworks.com/matlabcentral/fileexchange/105850-automatic-panoramic-image-stitcher-autopanostitc...

4 years ago | 1

Answered
How to get the value from Structure array ?
I=imread("https://www.mathworks.com/matlabcentral/answers/uploaded_files/996660/2_mask.png"); Ibw = im2bw(I); stat = reg...

4 years ago | 0

| accepted

Answered
I am writing a code for using "fmincon" but it is having some error, Why?
Your objective function is not returning numbers. It is returning sym variables, e.g., >> fun([0,0]) ans = (6.7465e+03*...

4 years ago | 1

| accepted

Answered
for loop to subtract row from columns
Punkte_Gesamt_D_Wasserhoehe([4:371],:)=... Punkte_Gesamt_D_Wasserhoehe([4:371],:)-Punkte_Gesamt_D_Wasserhoehe(3,:);

4 years ago | 0

Answered
How to find the maximum y-value from a window I select on a graph
Perhaps you meant, ymax = max(y1,y2) xmax = max(x1,x2)

4 years ago | 0

Answered
Filter function returns different results on different GPUs
Use double floating point, instead of single floating point. load('kilo_vars.mat') res1=filter(b1, a1, dataraw); res2...

4 years ago | 0

| accepted

Answered
Add cell to table
As a simplified example, T=array2table(rand(4,5)); %A randomly generated table Headings={'dog','cat','fish','fox','hamster'}...

4 years ago | 0

| accepted

Answered
Convert Character to Integer tnat can be used for Sum-function
There is no problem. Both X = 7.952110000000000e+03 and X = 7952.11 are the same number. However if you prefer the latter displ...

4 years ago | 0

| accepted

Answered
Indicate a new quiver for each lopp
.... quiver(-dpx,dpy); hold on end end hold off

4 years ago | 0

| accepted

Answered
Curve Fitting for multiple plots in single graphs
Just concatenate the x,y, data. x=[XCS1(:);XSC2(:)]; y=[VYS1(:);VYS2(:)]; cfit = fit(x,y,fitType)

4 years ago | 0

| accepted

Answered
How to calculate the inclination angle of whole box which their 4 vertices are stored in cell array with respect to the horizontal x-axis?
boxes = cellfun(@(z) cell2mat(z(:)) ,c ,'UniformOutput' ,false) boxes=cat(3,boxes{:}); rays=normalize( boxes(4,:,:)-boxe...

4 years ago | 1

| accepted

Answered
How to calculate the centroid of these bounding boxes which their 4 vertices are stored in cell array?
centroids = cellfun(@(z) mean(cell2mat(z(:))) ,c ,'UniformOutput' ,false)

4 years ago | 1

| accepted

Load more