Answered

When I export the figure, the x-axis is halved even though I have set the interval in the code.

I usually use export_fig(), https://github.com/altmany/export_fig

When I export the figure, the x-axis is halved even though I have set the interval in the code.

I usually use export_fig(), https://github.com/altmany/export_fig

4 days ago | 1

Answered

How to fill a hollow donut-shaped object so that it looks like a circle?

load Image montage( {BW, imfill(BW,'holes')}, [],'Back','w','Bor',5)

How to fill a hollow donut-shaped object so that it looks like a circle?

load Image montage( {BW, imfill(BW,'holes')}, [],'Back','w','Bor',5)

4 days ago | 0

| accepted

Answered

Is there a way to set MaxSQPIter for active-set algorithm under fmincon?

Probably because you didn't pass options to fmincon. Otherwise, show us your code.

Is there a way to set MaxSQPIter for active-set algorithm under fmincon?

Probably because you didn't pass options to fmincon. Otherwise, show us your code.

4 days ago | 1

Answered

histc problem in counting in particular bin

You are assuming that the bin boundaries are calculated with infinite precision, which is impossible. Likewise your data is also...

histc problem in counting in particular bin

You are assuming that the bin boundaries are calculated with infinite precision, which is impossible. Likewise your data is also...

4 days ago | 0

| accepted

Answered

Replace value that are associated to a location by nan

spl(0<= elevation & elevation<=100)=nan;

Replace value that are associated to a location by nan

spl(0<= elevation & elevation<=100)=nan;

4 days ago | 0

| accepted

Answered

Fit dataset to another dataset

See polyfit(). https://www.mathworks.com/help/matlab/ref/polyfit.html

Fit dataset to another dataset

See polyfit(). https://www.mathworks.com/help/matlab/ref/polyfit.html

4 days ago | 0

Answered

optimization of matrices with random initialization

Make sure your objective function code does not contain any randomization steps. Your initial guess can be random, but the objec...

optimization of matrices with random initialization

Make sure your objective function code does not contain any randomization steps. Your initial guess can be random, but the objec...

4 days ago | 0

| accepted

Answered

What dose this function mean and what is the differentes ?

The first is calculating the number of zeros in B and the second is summing all values in B (times -1).

What dose this function mean and what is the differentes ?

The first is calculating the number of zeros in B and the second is summing all values in B (times -1).

4 days ago | 0

Answered

Error in lsqcurvefit with 3 unknown parameters involved

If your model has 3 unknown parameters, then your initial guess P40 must be a vector of length 3.

Error in lsqcurvefit with 3 unknown parameters involved

If your model has 3 unknown parameters, then your initial guess P40 must be a vector of length 3.

4 days ago | 0

| accepted

Answered

sum only consecutive 1's in matrix

See, Tools for Processing Consecutive Repetitions in Vectors https://www.mathworks.com/matlabcentral/fileexchange/78008-tools...

sum only consecutive 1's in matrix

See, Tools for Processing Consecutive Repetitions in Vectors https://www.mathworks.com/matlabcentral/fileexchange/78008-tools...

4 days ago | 0

Answered

what is the fastest appproach to solve a system of non linear equations ?

Seems like it would make sense to regard this as a system of 100K simultaneous equations and solve for the PDE parameter with ls...

what is the fastest appproach to solve a system of non linear equations ?

Seems like it would make sense to regard this as a system of 100K simultaneous equations and solve for the PDE parameter with ls...

5 days ago | 0

Answered

How do we allocate equidistant points on a sinusoidal curve?

You should also have a look at interparc() https://www.mathworks.com/matlabcentral/fileexchange/34874-interparc?s_tid=srchtitle...

How do we allocate equidistant points on a sinusoidal curve?

You should also have a look at interparc() https://www.mathworks.com/matlabcentral/fileexchange/34874-interparc?s_tid=srchtitle...

5 days ago | 0

Answered

How do we allocate equidistant points on a sinusoidal curve?

You can use fzero, x_p=0; y=@(x) -25*sin((2*pi/50)*x); fun=@(d) d.^4+( y(x_p+d^2)-y(x_p)).^2 - 0.004^2; x=x_p+fzero(fu...

How do we allocate equidistant points on a sinusoidal curve?

You can use fzero, x_p=0; y=@(x) -25*sin((2*pi/50)*x); fun=@(d) d.^4+( y(x_p+d^2)-y(x_p)).^2 - 0.004^2; x=x_p+fzero(fu...

5 days ago | 1

| accepted

Answered

drawrectangle draws rectangle even though the mouse is clicked outside the parent UIAxes

You can fall back to imrect, if necessary fcn = makeConstrainToRectFcn('imrect',get(gca,'XLim'),get(gca,'YLim')); h=imrect('Po...

drawrectangle draws rectangle even though the mouse is clicked outside the parent UIAxes

You can fall back to imrect, if necessary fcn = makeConstrainToRectFcn('imrect',get(gca,'XLim'),get(gca,'YLim')); h=imrect('Po...

5 days ago | 0

Answered

Array processing using Taylor Series and FOR Loops to approximate sin value for each element in that array.

The array can be of any type and dimensions. If so, why does your code assume it will be 2D? Can't it be 3D or 4D? In any case...

Array processing using Taylor Series and FOR Loops to approximate sin value for each element in that array.

The array can be of any type and dimensions. If so, why does your code assume it will be 2D? Can't it be 3D or 4D? In any case...

6 days ago | 0

| accepted

Answered

How to store iterative information to a matrix?

The following is pretty typical. result=nan(big_number,1); while abs(y)>=small_number &iteration<big_number [x,y] = some...

How to store iterative information to a matrix?

The following is pretty typical. result=nan(big_number,1); while abs(y)>=small_number &iteration<big_number [x,y] = some...

6 days ago | 0

Answered

how to generate points inside a rectangle not parallel to axis in Matlab

You mean you want to generate N random points? If so, then, xy=Q*([length;width].*(rand(2,N)-0.5)) + center(:)

how to generate points inside a rectangle not parallel to axis in Matlab

You mean you want to generate N random points? If so, then, xy=Q*([length;width].*(rand(2,N)-0.5)) + center(:)

6 days ago | 0

| accepted

Answered

How do I add zero padding to this convolution?

Not sure what the question is, but you can easily compare your result to direct convolution to see if it's correct. x1x2_conv =...

How do I add zero padding to this convolution?

Not sure what the question is, but you can easily compare your result to direct convolution to see if it's correct. x1x2_conv =...

7 days ago | 1

Answered

How to tell an multi-output anonymous function to vectorize its output components which are constant

One way, f=@(x,y) completeRows({x+y;2;x*y;x.^2-1;3}); f([1 2],3) function out=completeRows(C) n=max(cellfun('length',...

How to tell an multi-output anonymous function to vectorize its output components which are constant

One way, f=@(x,y) completeRows({x+y;2;x*y;x.^2-1;3}); f([1 2],3) function out=completeRows(C) n=max(cellfun('length',...

8 days ago | 0

| accepted

Answered

Area between three curves

A=Einspeiseanteil; B=GabelstaplerP; C=max(A,B); area=trapz(X,(C-Y).*(C>=Y))

Area between three curves

A=Einspeiseanteil; B=GabelstaplerP; C=max(A,B); area=trapz(X,(C-Y).*(C>=Y))

8 days ago | 0

Answered

How to plot vectors exactly on the edge of another graph?

t=linspace(0,360,91); t(end)=0; u=cosd(t); v=sind(t); fimplicit(@(a,b) a.^2+b.^2-1);hold on quiver(u,v,u,v,'Color','r...

How to plot vectors exactly on the edge of another graph?

t=linspace(0,360,91); t(end)=0; u=cosd(t); v=sind(t); fimplicit(@(a,b) a.^2+b.^2-1);hold on quiver(u,v,u,v,'Color','r...

9 days ago | 1

| accepted

Answered

How can I assign values to min/max of a column within each value of another column?

Let's call your table T, then, T=table(randi(2,10,1), randi(100,10,1), rand(10,1),'V',{'Device','Time','current'}) str=[""...

How can I assign values to min/max of a column within each value of another column?

Let's call your table T, then, T=table(randi(2,10,1), randi(100,10,1), rand(10,1),'V',{'Device','Time','current'}) str=[""...

9 days ago | 0

| accepted

Answered

min and max optimization as a single minimization function

if i am adding these function together like as follows min(f)=(1/f1)+f2 will it be correct? can i get the proper result? The s...

min and max optimization as a single minimization function

if i am adding these function together like as follows min(f)=(1/f1)+f2 will it be correct? can i get the proper result? The s...

9 days ago | 0

Answered

4D matrix multiplication

steer=reshape( permute(steer,[2,3,4,1]),101^2,[],136 ); R=permute(R,[2,3,1]); F=1./sum( pagemtimes(conj(steer),R).*steer, 2...

4D matrix multiplication

steer=reshape( permute(steer,[2,3,4,1]),101^2,[],136 ); R=permute(R,[2,3,1]); F=1./sum( pagemtimes(conj(steer),R).*steer, 2...

9 days ago | 0

| accepted

Answered

plotting two lines intersecting at a certain point

This is equivalent to a first order free-knot spline fit. This FEX submission might be useful, https://www.mathworks.com/matlab...

plotting two lines intersecting at a certain point

This is equivalent to a first order free-knot spline fit. This FEX submission might be useful, https://www.mathworks.com/matlab...

9 days ago | 0

Answered

how do you create an array of 3d arrays

I've been trying different ways of using the cat function You haven't told us in what form the 15 stacks exist now. If you have...

how do you create an array of 3d arrays

I've been trying different ways of using the cat function You haven't told us in what form the 15 stacks exist now. If you have...

9 days ago | 0

Answered

How to grow a vector in a loop?

coef=nan((ldiv+1)^2*(sdiv+1)^2,1); %PRE-ALLOCATE mm=0; for ii = 1:ldiv+1 for jj = 1:sdiv+1 ... ...

How to grow a vector in a loop?

coef=nan((ldiv+1)^2*(sdiv+1)^2,1); %PRE-ALLOCATE mm=0; for ii = 1:ldiv+1 for jj = 1:sdiv+1 ... ...

9 days ago | 0