Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: which function in PDL can do the same thing as matlab pcolor?

by vr (Curate)
on Dec 14, 2019 at 16:23 UTC ( [id://11110121]=note: print w/replies, xml ) Need Help??


in reply to which function in PDL can do the same thing as matlab pcolor?

Maybe not an answer you were expecting, it appears PDL does not provide interface to some GSL functions. The PDL::GSL::INTERP describes 1D interpolation only. However, there are 2D interpolation functions for irregular/non-uniform X-Y grid, exactly as you require. Then, after interpolating for points on regular grid, you could proceed to visualization on a 2D image, etc.

There is "gsl_interp2d.h" in my Strawberry Perl installation, so it must be possible to call these functions from existing libgsl dll. Writing PDL bindings is beyond my scope, but perhaps it's not prohibitively difficult to use FFI in this case.

Another possibility, I had in mind even before finding the above, is that irregular grid is just a specific case of any random set (not a grid) of (X,Y) points for which f(X,Y) is known. From f(X,Y) for any set, to f on regular grid, for reasonably well-behaving function and if linear interpolation is good enough -- I did that before, though it's not PDL. First, triangulate X-Y plane, then interpolate for regular grid points inside each triangle.

Replies are listed 'Best First'.
Re^2: which function in PDL can do the same thing as matlab pcolor?
by etj (Deacon) on Apr 25, 2022 at 11:19 UTC
    Come on in, the water's lovely! (really, it's not that difficult)

    One thing to note would be after one adds a pp_def, one needs to re-run perl Makefile.PL because the "multi-C" feature bakes the available function names into the generated Makefile so that only things actually changed need rebuilding. A way to "cheat" here is to copy-paste similar functions and just rename them, so the recreating of Makefiles only needs doing once.

    I'd suggest calling this function eval2d. You'd need 2D versions of init, new_spline, etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110121]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found