Answered
Cutting everything above an intersection of two elipses
Just use min(). Example: x=linspace(-3,3); y1=(x-1).^2; y2=(x+1).^2; figure; plot(x,y1,'--r',x,y2,'--r'); ylim([0,4]) ...

3 years ago | 1

Answered
When a global variable is justified
To fix this, I would need to intorduce an additional input variable in all definitions and calls. No, you could add the debug f...

3 years ago | 1

Answered
Fittype with anonymous function of multiple parameters and variables
alpha=1; beta=2; ft0 = fittype( @(gamma,x,y) exp(-(alpha.*x+beta*x.^2)).*exp(-(gamma*x.*y)),... '...

3 years ago | 0

| accepted

Answered
How to subtract false color gradient ?
detrend() operates column by column. I suspect you can avoid the lines by subtracting a plane fit to the whole surface instead, ...

3 years ago | 0

Answered
Create square marix of values for a 2 variable function.
x= 0:0.01:100; y=(0:0.01:100)'; f=cos(x)+sin(y)

3 years ago | 0

| accepted

Answered
Page-wise Diagonalization?
A=rand(4,1,3); pagetranspose(A) [n,~,p]=size(A); B=zeros(n^2,p); B(1:n+1:end,:)=reshape(A,n,p); B=reshape(B,n,n,p)

3 years ago | 1

Answered
Plot 2D images into 3D cylindrical image
Each slice of the 3D image can be obtained by using 2D scattered interpolation of the radial samples formed by the 2D images.. U...

3 years ago | 0

Answered
Calculation of the volume of a convex polytope as a function of indeterminate parameters
I don't know if the computation is tractable, in light of what John said, but here is code that will attempt it using the FEX do...

3 years ago | 1

Answered
To make smaller hexagons at the points marked with cross in black
Forming the hexagons is easy enough using nsidedpoly (see below), but you need to use the delaunay triangulation to determine wh...

3 years ago | 1

| accepted

Answered
scatteredInterpolant: what is linear interpolation in 2d?
No, the support points are being divided into triangular elements, not rectangles. It is puzzling that you would be using scatte...

3 years ago | 0

| accepted

Answered
Displaying MATLAB tables wrapped
One possibility, TBL=array2table(rand(4,12)); wrapit(TBL) function wrapit(T,ncols) if nargin<2, ncols=7; end M=c...

3 years ago | 0

Answered
Calculating distance between 2 curves
If you are trying to find the intersections of the magenta lines (extended to infinity) with the red curve, then this might help...

3 years ago | 0

Answered
Fmincon finds different solutions for optimization problem in dependance of initial values
You might find it easier to reach a good solution if you simplified the implementation of your constraints. In particular, your ...

3 years ago | 0

Answered
Can I loop through arguments and loop back to original names
Is this what you mean? inputs = {value, min, max}; for i = 1:numel(inputs) ... end [value,min,max]=inputs{:};

3 years ago | 0

| accepted

Answered
How are editors supposed to know the difference between transpose operators and character arrays?
A cheezy, but compact way you could define an alternative ctranspose operator (temporarily, within a particular workspace) is wi...

3 years ago | 2

| accepted

Answered
How are editors supposed to know the difference between transpose operators and character arrays?
This seems to offer Jupyter Lab integration in a way that preserves Matlab syntax highlighting, https://github.com/mathworks/j...

3 years ago | 0

Answered
Raising a large sparse matrix to a large power
The actual recursion follows the structure x(n+1) = x(n) + AM^nBy(n) where each instance of x is a 5-by-3 matrix, A is 5-by-20,0...

3 years ago | 1

| accepted

Answered
Single iteration with lsqnonlin (or fsolve), only compute new X0
This seems to be a feasible workaround. So, the important thing to realize is that even though the iterative display says the Fu...

3 years ago | 0

| accepted

Answered
Convolution of function on a non symmetric axis using 'conv'
This might be what you're after: % convolve model with resolution A1 = axconv(M1,R1,x); A2 = axconv(M2,R2,xx); fig...

3 years ago | 1

| accepted

Answered
Using a standalone application
You can certainly distribute it. Whether other people will be able to run it will depend on the manner in which you are dstribut...

3 years ago | 1

Answered
Aggregate data every 10 seconds
This syntax of retime looks like the applicable one, TT2 = retime(TT1,'regular',method,'TimeStep',dt)

3 years ago | 0

| accepted

Answered
Can't plot contour graph on a different plane
figure(2) iy =1; contourf(squeeze(x_mesh(:,iy,:)),squeeze(z_mesh(:,iy,:)),squeeze(g(:,iy,:))) title('x^\prime z^\prime plane'...

3 years ago | 0

| accepted

Answered
how to solve diagonal matrix of each page of a 3D vector ? pagediag?
A=rand(1,4,3) [~,n,p]=size(A); B=zeros(n^2,p); B(1:n+1:end,:)=reshape(A,n,p); B=reshape(B,n,n,p)

3 years ago | 0

Answered
Radon Transform works unexpectedly
Instead of radon(), you could use one of the parallel beam forward projectors (the SIddon algorithm is probably best) from the T...

3 years ago | 2

| accepted

Answered
Split data into groups without applying a function
G=findgroups(Gender); groupedHeight=splitapply(@(x){x}, Height,G)

3 years ago | 0

| accepted

Answered
The best approach to avoid the Kullback–Leibler divergence equal to infinite
% Input A =[ 0.444643925792938 0.258402203856749 0.224416517055655 0.309641873278237 0.0...

3 years ago | 1

| accepted

Answered
Identify the point where three lines are meeting, thus making a Y section.
Use delaunay to form the delaunay triangulation and then freeBoundary to find which vertices are on the boundary. The vertices t...

3 years ago | 0

Answered
Computing variance of a variable after linear fit using lsqcurvefit function
It would be, yvariance = [1,x0]*ACovariance*[1;x0]

3 years ago | 0

Answered
Solving Matrix Equations With Unknown at Both Sides
T1=optimvar('T1'); T2=optimvar('T2'); F2=optimvar('F2'); prob=eqnproblem; prob.Equations.eqn=[1 -0.5 4;-0.5 2 0; 4 0 3]*[T...

3 years ago | 0

Answered
Solving Matrix Equations With Unknown at Both Sides
Since these are linear equations, you would re-arrange in the form Matrix*[T1;T3;F2] =[4; 0; 5] and solve normally.

3 years ago | 0

Load more