Answered
GriddedInterpolant performance, meshgrid vs ndgrid formats
Presumably because ndgridded query data will result in the data being looped through with better memory locality.

5 years ago | 0

Answered
Dimensions of arrays being concatenated are not consistent.
discpath = [r(i+1,1)-r(i,1);r(i+1,2)-r(i,2);u(r(i+1,1),r(i+1,2)); u(r(i,1),r(i,2))]; % ...

5 years ago | 0

| accepted

Answered
Fzero function parameter issues
If your function will always be a polynomial, you should just use roots(). To handle cases where your function is not a polynom...

5 years ago | 1

| accepted

Answered
Change workspace from function to base
I don't see anything named stack above the editor window. You will not see it until you are at a breakpoint, but once you are i...

5 years ago | 2

| accepted

Answered
How can I determine if a value is in the interval?
isInside = discretize(1.957, [1.410,2.504])==1

5 years ago | 2

| accepted

Answered
what is the difference in fft(x,1024) and fft(x,2048)?
The 2nd and 3rd cases are equivalent. The 1st case is the same as if you had discarded the last 1024 x(i), as can be seen from, ...

5 years ago | 0

Answered
For Loop Indexing of matrices
Using mat2tiles https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-divide-array-into-equal-sized-sub-arrays ...

5 years ago | 1

Answered
1 iteration in fsolve: new x and no more
One option is to use fsolve just to get the Jacobian and then generate x1 yourself. This gives you access to JacobPattern and a...

5 years ago | 0

| accepted

Answered
1 iteration in fsolve: new x and no more
The solution would to program a similar routine myself, but I rather use fsolve (i also want to use JacobPattern for example). ...

5 years ago | 0

Answered
fft is not matching with analytical solution
Different professions define the scaling of the continuous Fourier Transform differently. If the definition that you use is, ...

5 years ago | 0

Answered
finding the closest orthonormal basis to a given (non-orthogonal) basis
[U,~,V]=svd(Jn); O=U*V';

5 years ago | 0

Answered
How to apply sum function for simulating charges around a circle?
xs=linspace(0,10,500); [x,y,t]=meshgrid(xs,xs, 0:pi/8:pi/2); r=5; z=sum(1./ ( (x-r*cos(t)).^2 + (y-r*sin(t)).^2 ), 3);...

5 years ago | 0

Answered
How can i handle division by zero inside the symsum function?
Why do things symbolically at all? [x,y,k]=meshgrid(-10:1:10,-10:1:10, -1:+1); z= sum( 1./((x-k).^2+y.^2) , 3); surf(x(:...

5 years ago | 1

| accepted

Answered
How to plot a curve tangent to many ellipses.
alphaShape.boundaryFacets might also be applicable, https://www.mathworks.com/help/matlab/ref/alphashape.boundaryfacets.html

5 years ago | 2

Answered
How to find intersection between a line (given by 2 points) and a plane?
Since A and B both lie in the plane z=0, clearly the entire line segment will intersect the plane at z=0 and will not intersect ...

5 years ago | 0

Answered
slp error matlab function
Your functions f_ and g_SLPclass have missing parts. function [f,g]=f_SLPclass(x) %return outputs assert(length(x)==5, "x ...

5 years ago | 0

| accepted

Answered
Extract only odd rows in a matrix
m=y(1:2:end,3);

5 years ago | 0

Answered
How to generate a set of N mutually orthogonal (N being a power of 2) N-dimensional binary vectors [+1,-1]?
N=4096; [C,C0]=deal([1 1;1 -1]); tic; for i=1:log2(N/2) C=kron(C0,C); end toc isOrthogonal=isequal(C*C.', N*spey...

5 years ago | 2

| accepted

Answered
computing the cumulative matrix with some conditions
Is this what you want? T=[0, 2, 4, -5] ; result=cumsum(T(AR))

5 years ago | 0

Answered
intersection area of 3 or more rectangles
If you put your rectangles in the form of a polyshape vector (I'll call it polyvec), then it is very easy: Area = area(intersec...

6 years ago | 0

Answered
overall area of intersecting rectangles
If you put the rectangles in the form of a polyshape vector, poly, then it is quite easy: Area= area(union(poly));

6 years ago | 0

| accepted

Answered
Concatenate matrices not the same size - without NaN
Is there an existing function for this There is now: a=NaN; C = padcat(a, [1 2 3; 4 5 6; 7 8 9] , [1 2; 3 4] ) functi...

6 years ago | 1

| accepted

Answered
fsolve terminate far before finding answer when using TolFun option
Can anyone help me to know how should I solve this issue You should make TolFun a lot smaller. Note that x_solution and TolF...

6 years ago | 0

| accepted

Answered
Shift columns of a matrix with different values
A = [10, 12, 14, 11; 8 , 10, 13, 10; 7 , 8, 12, 8; 6 , 7, 10, 7; 5 , 6, 8, 6; 3 , 5, 7, ...

6 years ago | 0

Answered
Shift columns of a matrix with different values
A = [10, 12, 14, 11; 8 , 10, 13, 10; 7 , 8, 12, 8; 6 , 7, 10, 7; 5 , 6, 8, 6; 3 , 5, 7, ...

6 years ago | 2

Answered
Troubles with MATLAB genetic algorithm nonlinear constraint function
If you re-run your code after executing, >>dbstop if caught error you will be able to trace the problem.

6 years ago | 1

Answered
How to fit an exponential curve? error: Dimensions of arrays being concatenated are not consistent
Did you mean, [[ones(size(time)); -exp(-time)].\E_f; ones(size(time))]

6 years ago | 0

Answered
Why does subclassing a numeric type break its use as a property of a custom class?
1. Why does my code work for double but not ExtendDouble? The ExtendDouble example is old. It's subsasgn() method was not writt...

6 years ago | 2

| accepted

Answered
How can I create a vector like this : X = [1, 2, 1, 2 ......
X=ones(1,n); X(2:2:end)=2;

6 years ago | 2

Load more