Multidimensional Shape Preserving/Monotone Spline - Matlab - matlab

Does anyone know whether matlab has anything similar to PCHIP for multidimensional interpolation? I can use it for 1-dimensional interpolation. For multidimensional, matlab only allows me to use spline. The issue with splines is that they are not shape preserving. Below an example taken from here on why the difference between them is actually very important:

Related

Radon Transform derivation Matlab, finding reasonable F(x,y)

For a project in the University I am working with several "Quality Assessement" metrics on Finger-Vein images.
Now I try to implement a metric that uses the Radon Transform and I got stuck at some point doing this in Matlab.
My problem is as follows:
I got the following formula for the Radon Transform. In the first steps I used the built in one in Matlab, but for further implementing the metric I need the derivation of the thing for the Curvature of the curve.
the delta is the dirac-delta function.
Derivation:
So my intention is to calculate the Radon Transform on my own with the formula but my problem is that F(x,y) is the gray value of the pixel located at (x,y). And so I need a Function F(x,y) that gives me the gray value of the pixel that I can put in to calculate the derivates and the double integral.
How can I get such a function? Or got I do some kind of "Curve Fitting" with my values of the pixels that I get a function?
Thanks in advance.
As I understand your question, there are two things that you could do:
Compute the derivatives of the Radon transform numerically (as suggested by Ander Biguri in a comment above). If you compute the Radon transform carefully, it will be a band-limited function, making the computation of derivatives possible. See this paper for some ideas on how to enforce a band-limited transform:
"The generalized Radon transform: sampling, accuracy and memory considerations" (PDF).
Compute the derivatives of the image numerically, then sample those derivatives to compute your C function. That is, you compute dF/dx, dF/dy, d^2F/dx^2, and whichever derivatives you need as images. You can interpolate into these derivatives if you need more precision.
IMO the best way to compute derivatives of a discrete image is through Gaussian derivatives. Note that this applies to both solutions above. For example dF/dx (Fx) can be computed by (see here for more details):
h = fspecial('gaussian',[1,2*cutoff+1],sigma);
dh = h .* (-cutoff:cutoff) / (-sigma^2);
Fx = conv2(dh,h,F,'same');
PS: sorry for all the self-references, but I have worked on these topics quite a bit in the past. :)

how to get the area of a region using matlab

I want to plot some equations and inequalities like x>=50, y>=0,4x-5y>=8,x=40,x=60,y=25, y=45 in matlab and want to get the area produced by intersecting these equations and inequalities. Is it possible using matlab? If yes can someone provide me some manual? If not, is there some other software that can do this?
Integrals would work for your purposes, provided you know the points at which the curves intersect (something Matlab is also able to compute). Take a look at the documentation on the integral function.
q = integral(fun,xmin,xmax) approximates the integral of function fun
from xmin to xmax using global adaptive quadrature and default error
tolerances.
EDIT: As an additional resource, take a look at the code provided by user Grzegorz Konz on the Mathworks blog.
EDIT #2: I'm not familiar with any Matlab functions that'll take a vector of functions and return the points of intersection (if any) between all the curves. Users have produced functions that return the set of intersection points between two curves. You could run this function for each pair of equations in your list and use a function like polyarea to compute the area of the enclosed region if the curves are all straight lines.

Method behinds "interp2" command

I always use interp2 to interpolate my data in MATLAB.
But I want to know what kind of algorithm is really used when running that command, such as Local Weight Regression (LWR) or something.
If you type doc interp2, you'll see that you can specify one of four different methods that interp2 can use: nearest neighbour interpolation, linear interpolation, cubic spline interpolation, or cubic interpolation.
If you don't specify one of those explicitly, it will use the default method, which is linear interpolation.

How to plot a 3D figure in matlab based on a function like f(x,y,z)=0?

How to plot a 3D figure in MATLAB based on a function like f(x,y,z)=0?
And this complicated function can not be written as z = f(x,y).
f(x,y,z)=sum(a.*exp(sv(:,1)-x).^2+sv(:,2)-y).^2+sv(:,3)-z).^2)-b=0
where a is a known vector, sv is a known matrix, b is a known value. x,y,z are three variables. How to draw this surface in 3D way in matlab?
I just solve this question by this tool from the Matlab File Exchange:
Ezimplot3: implicit 3D functions plotter
your function only contains 1D vectors( I am assuming they are of equal lengths), if summed it will give you a constant; therefore, there is really nothing to plot.

Transform a solution vector of PDE into a piecewise linear function - MATLAB

I know that when I use the PDE toolbox in Matlab to solve a PDE the result is a vector, which represents the values of the function in each vertex of the mesh.
Is there a command in the PDE toolbox such that we could transform the vector solution into a piecewise linear function on the domain of definition, so that we could be able to use it like u(x,y) to find directly the approximate value in (x,y)?
I don't know about such function. But your solution is defined on a structured rectangular grid. If you simply need to interpolate data on a 2D rectangular grid, you can use interp2 for that. If your grid is made of triangles, use TriScatteredInterp. If you want to use different interpolation (e.g., FEM), you will have to implement it yourself.