Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6712455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:15:42+00:00 2026-05-26T08:15:42+00:00

I am having a problem with TriScatteredInterp in MatLab. I am using a set

  • 0

I am having a problem with TriScatteredInterp in MatLab.
I am using a set of coordinate points with the corresponding temperature at that location. They are all in degrees in the form (long, lat, temp). I want to make an interpolant on these points so I can find out the values at other points and build a grid.
This is what I have done so far:

long = data(:,1)
lat = data(:,2)
values = data(:,3)
lat = lat.*(pi/180)
long = long.*(pi/180)
X = cos(lat).*cos(long)
Y = cos(lat).*sin(long)
Z = sin(lat)
F = TriScatteredInterp(X,Y,Z,values)
[long1 lat1] = meshgrid(-pi:pi/360:pi, -pi/2:pi/360:pi/2);
X1 = cos(lat1).*cos(long1)
Y1 = cos(lat1).*sin(long1)
Z1 = sin(lat1);
F.Method = 'natural'
InterpVals = F(X1,Y1,Z1);
mesh(long1, lat1, InterpVals)

As you can see for every (long, lat) point, I have computed the corresponding point on the sphere and have used the 3d version of TriScatteredInterp.
The problem is that the interpolation only works for the ‘nearest’ method, as for the linear or natural is producing just NaN’s. As I have read this happens when the points that I want to interpolate are outside of the convex hull of the triangulation, but as the points needed are exactly on the sphere, and the input points are covering the entire range (Long : -180 to 180, Lat : -90 to 90), I just don’t see how all the points could be outside the convex hull. Any help will be appreciated , ty.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:15:43+00:00Added an answer on May 26, 2026 at 8:15 am

    You should interpolate values on the bi-dimensional original data (long, lat), not on the tri-dimensional one (X, Y, Z).
    Note that I included some dummy data generator, for the readers that do not have access to your data()!

    n = 100;
    long = rand(n,1)*720-360;
    lat = rand(n,1)*180-90;
    values = rand(n,1)*30-5;
    lat = lat.*(pi/180);
    long = long.*(pi/180);
    
    F = TriScatteredInterp(long,lat,values);
    [long1 lat1] = meshgrid(-pi:pi/36:pi, -pi/2:pi/24:pi/2);
    InterpVals = F(long1,lat1);
    
    X1 = cos(lat1).*cos(long1);
    Y1 = cos(lat1).*sin(long1);
    Z1 = sin(lat1);
    mesh(X1,Y1,Z1,InterpVals); %note here the meshing on the regular grid (X1,Y1,Z1)
    

    There is still an issue on the edges of the map, as the interpolator doesn’t know that the data “wraps” around. The content of InterpVals on those edges will be.. NaN!

    Edit: suggestions for the wrapping:
    1) rewrite TriScatteredInterp so that it uses modulos;
    2) mirror the data around the “edges” of the map, interpolate, then crop it back to original size;
    3) check out the Matlab Mapping Toolbox, which analyze and visualize geographic information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are having problem with the server migration. We have one application that are
I am having problem in getting reference of Ajax control extender using $find() or
I'm having problem restricting a query in mdx, using except function at where clause.
i'm having problem when i want to select element using querySelector <ul class=xoxo blogroll>
I'm having problem with SHGetFileInfoW function I'm using. It's a quite slow and first
hey there i am having problem i have List<List<memoryCard>> that i want to show
I am having problem filtering the mousePressEvent with installEventFilter MyTestxEdit is a widget that
i am having problem in installing provision it gies me error that A validcode
i'm having Problem with sending Email in Persian. It's Ok on gmail, all of
I'm having problem getting all the values in datalist here is the problem: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.