Interpolation (interp2 help) (2024)

20 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Brent Majcher am 28 Feb. 2022

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help

Kommentiert: Brent Majcher am 1 Mär. 2022

Akzeptierte Antwort: John D'Errico

  • Screen Shot 2022-02-27 at 6.25.05 PM.png
  • Screen Shot 2022-02-27 at 6.25.09 PM.png

Hey all,

Wondering if theres anyone who can help me with the interp2 function.

I have two (2) CSV files with surface coordinates that I am importing (X, Y, Z). The two data sets have coordinates that are of different densities (pts per meter square).

I want to compare the data in the Z axis, and therefore I need to generate a 'smoothened' grid that has coordinates regenerated at fixed X Y values that are defined between both sets, and I would like to use interp2 to generate this data to keep things statistically meaningful.

I have attached two screenshots, one showing the variable definitions and the code run that produces the highlighted error.

Any help would be hugely appreciated.

A = interp2(sX(:,1),sX(:,2),sX(:,3),sDt(1,:),sD(:,2),'cubic')

Regards,

B

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Akzeptierte Antwort

John D'Errico am 28 Feb. 2022

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help#answer_905955

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help#answer_905955

In MATLAB Online öffnen

Interp2 does NOT apply to scattered data. You chose the wrong interpolation tool. You MAY be able to use

help scatteredInterpolant

scatteredInterpolant Scattered data interpolation scatteredInterpolant performs interpolation on scattered data that resides in 2-D or 3-D space. A scattered data set is defined by sample points X and corresponding values v. A scatteredInterpolant object F represents a surface of the form v = F(X). Interpolated values vq at query points Xq are obtained by evaluating the interpolant, vq = F(Xq). F = scatteredInterpolant creates an empty scattered data interpolant. F = scatteredInterpolant(X,v) creates an interpolant that fits a surface of the form v = F(X) to the sample data set (X,v). The sample points X must have size NPTS-by-2 in 2-D or NPTS-by-3 in 3-D, where NPTS is the number of points. Each row of X contains the coordinates of one sample point. The values v must be a column vector of length NPTS. F = scatteredInterpolant(x,y,v) and F = scatteredInterpolant(x,y,z,v) also allow the sample point locations to be specified in alternative column vector format when working in 2-D and 3-D. F = scatteredInterpolant(...,METHOD) specifies the method used to interpolate the data. METHOD must be one of the following: 'linear' - (default) Linear interpolation 'nearest' - Nearest neighbor interpolation 'natural' - Natural neighbor interpolation The 'natural' method is C1 continuous except at the sample points. The 'linear' method is C0 continuous. The 'nearest' method is discontinuous. F = scatteredInterpolant(...,METHOD,EXTRAPOLATIONMETHOD) also specifies the extrapolation method used for query points outside the convex hull. EXTRAPOLATIONMETHOD must be one of the following: 'linear' - (default if METHOD is 'linear' or 'natural') Linear extrapolation based on boundary gradients 'nearest' - (default if METHOD is 'nearest') Evaluates to the value of the nearest neighbor on the convex hull boundary 'none' - Queries outside the convex hull return NaN Example: % Construct a scatteredInterpolant F from locations x,y and values v t = linspace(3/4*pi,2*pi,50)'; x = [3*cos(t); 2*cos(t); 0.7*cos(t)]; y = [3*sin(t); 2*sin(t); 0.7*sin(t)]; v = repelem([-0.5; 1.5; 2],length(t)); F = scatteredInterpolant(x,y,v) % Evaluate F at query locations xq,yq to obtain interpolated values vq tq = linspace(3/4*pi+0.2,2*pi-0.2,40)'; xq = [2.8*cos(tq); 1.7*cos(tq); cos(tq)]; yq = [2.8*sin(tq); 1.7*sin(tq); sin(tq)]; vq = F(xq,yq); % Plot the sample data (x,y,v) and interpolated query data (xq,yq,vq) plot3(x,y,v,'.',xq,yq,vq,'.'), grid on title('Linear Interpolation') xlabel('x'), ylabel('y'), zlabel('Values') legend('sample data','interpolated query data','Location','best') % Change the interpolation method from 'linear' to 'nearest' F.Method = 'nearest' % Perform nearest neighbor interpolation and plot the result vq = F(xq,yq); figure plot3(x,y,v,'.',xq,yq,vq,'.'), grid on title('Nearest Interpolation') xlabel('x'), ylabel('y'), zlabel('Values') legend('sample data','interpolated query data','Location','best') scatteredInterpolant properties: Points - Locations of the scattered sample points Values - Values associated with each sample point Method - Method used to interpolate at query points ExtrapolationMethod - Extrapolation method used outside the convex hull scatteredInterpolant methods: vq = F(Xq) evaluates the scatteredInterpolant F at scattered query points Xq and returns a column vector of interpolated values vq. Each row of Xq contains the coordinates of one query point. vq = F(xq,yq) and vq = F(xq,yq,zq) also allow the scattered query points to be specified as column vectors of coordinates. Vq = F(Xq,Yq) and Vq = F(Xq,Yq,Zq) evaluates F at gridded query points specified in full grid format as 2-D and 3-D arrays created from grid vectors using [Xq,Yq,Zq] = NDGRID(xqg,yqg,zqg). Vq = F({xqg,yqg}) and Vq = F({xqg,yqg,zqg}) also allow a grid of query points to be specified in compact form as grid vectors. Use this syntax to conserve memory when the query points form a large grid. Vq has the same size as the grid: LENGTH(xqg)-by-LENGTH(yqg) or LENGTH(xqg)-by-LENGTH(yqg)-by-LENGTH(zqg). See also griddedInterpolant, griddata, delaunayTriangulation Documentation for scatteredInterpolant doc scatteredInterpolant

Since I don't see youe actual data, I cannot be sure of what you are doing. However, I should point out that an interpolant does not necessarily maintain any statistical properties of your data.

2 Kommentare

Keine anzeigenKeine ausblenden

Brent Majcher am 1 Mär. 2022

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help#comment_2012395

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help#comment_2012395

Thanks so much, owe ya a beer

Brent Majcher am 1 Mär. 2022

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help#comment_2012440

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1659795-interpolation-interp2-help#comment_2012440

Out of curiosity, are there functions that pre exist or toolboxes I can utilize that are similar to scatteredInterpolant that will make this data more statistically relevant? I understand this function interpolates between data points in a more or less linear fashion, and this may not take into account "static" or errors that might occur at singular points.

Can I 'smoothen' the data prior to or perhaps during my script first?

Thanks,

Brent

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

MATLABMathematicsInterpolation

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Tags

  • interp2
  • interpolation

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by Interpolation (interp2 help) (5)

Interpolation (interp2 help) (6)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Kontakt zu Ihrer lokalen Niederlassung

Interpolation (interp2 help) (2024)
Top Articles
Roger Penrose’s Impossible Diagrams | More than Nothing: A History of the Vacuum in Theoretical Physics, 1925-1980
Simple Simon Pizza Portales Nm
Mcgeorge Academic Calendar
Nyu Paralegal Program
Readyset Ochsner.org
Robinhood Turbotax Discount 2023
Top 10: Die besten italienischen Restaurants in Wien - Falstaff
Celsius Energy Drink Wo Kaufen
Aquatic Pets And Reptiles Photos
The Weather Channel Facebook
My.doculivery.com/Crowncork
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Aspen.sprout Forum
Games Like Mythic Manor
Napa Autocare Locator
Transfer and Pay with Wells Fargo Online®
H12 Weidian
Gentle Dental Northpointe
Halo Worth Animal Jam
Busted Newspaper Fauquier County Va
Finalize Teams Yahoo Fantasy Football
Iu Spring Break 2024
Craigslist Pearl Ms
Dulce
2021 Volleyball Roster
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Yonkers Results For Tonight
C&T Wok Menu - Morrisville, NC Restaurant
Rs3 Ushabti
Silky Jet Water Flosser
eugene bicycles - craigslist
The Boogeyman (Film, 2023) - MovieMeter.nl
CVS Health’s MinuteClinic Introduces New Virtual Care Offering
Black Lion Backpack And Glider Voucher
Ehome America Coupon Code
Craigslist Cars And Trucks Mcallen
Glossytightsglamour
Junee Warehouse | Imamother
Asian Grocery Williamsburg Va
Marcus Roberts 1040 Answers
Infinite Campus Farmingdale
The Listings Project New York
Craigslist Food And Beverage Jobs Chicago
Best Suv In 2010
Cvs Coit And Alpha
Joblink Maine
Ratchet And Clank Tools Of Destruction Rpcs3 Freeze
Motorcycles for Sale on Craigslist: The Ultimate Guide - First Republic Craigslist
Here’s What Goes on at a Gentlemen’s Club – Crafternoon Cabaret Club
Slug Menace Rs3
Is Chanel West Coast Pregnant Due Date
Kindlerso
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5519

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.