Clear Filters
Clear Filters

How can i interpolat my data

2 views (last 30 days)
b.m.n n
b.m.n n on 17 Jan 2017
Commented: Star Strider on 21 Jan 2017
Could anyone help me ,How can i interpolat my data Q1(37*1),Q2(38*1),depth(0:5:25)
I Created a new depthe D ,and when i use this code >>
X = interp1 (D, Q2, depth, 'linear');
y = interp1 (D, Q1, depth, 'linear');
showing this error
Error using griddedInterpolant The grid vectors do not define a grid of points that match the given values. Error in interp1 (line 183) F = griddedInterpolant(X,V,method); thank you ....

Answers (1)

Star Strider
Star Strider on 17 Jan 2017
Your ‘D’, ‘Q1’ and ‘Q2’ vectors have to be the same length. You have to decide how to equalize them.
It is probably easier to create ‘D’ as (37x1) and remove one point (probably Q2(end)) from ‘Q2’.
If ‘depth’ uses values outside the range of ‘D’, remember to specify a method (for example 'linear') and use the 'extrap' option.
  4 Comments
b.m.n n
b.m.n n on 21 Jan 2017
Thanks for your advice

Sign in to comment.

Categories

Find more on Descriptive Statistics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!