Error using matlab internal math interp1 sample points must be unique

Error: Sample points must be unique and sorted in ascending order. Direct link to this question Direct link to this question 0 Comments Accepted Answer Direct link to this answer Direct link to this answer 0 Comments More Answers (0) See Also Categories Products Release Community Treasure Hunt Find the treasures in MATLAB Central […]

Содержание

  1. Error: Sample points must be unique and sorted in ascending order.
  2. Direct link to this question
  3. Direct link to this question
  4. Accepted Answer
  5. Direct link to this answer
  6. Direct link to this answer
  7. More Answers (0)
  8. See Also
  9. Categories
  10. Products
  11. Release
  12. Community Treasure Hunt
  13. How to Get Best Site Performance
  14. Americas
  15. Europe
  16. Asia Pacific
  17. Error: Sample points must be unique and sorted in ascending order.
  18. Direct link to this question
  19. Direct link to this question
  20. Accepted Answer
  21. Direct link to this answer
  22. Direct link to this answer
  23. More Answers (0)
  24. See Also
  25. Categories
  26. Products
  27. Release
  28. Community Treasure Hunt
  29. How to Get Best Site Performance
  30. Americas
  31. Europe
  32. Asia Pacific
  33. Internal math error when using interpolation
  34. Direct link to this question
  35. Direct link to this question
  36. Direct link to this comment
  37. Direct link to this comment
  38. Direct link to this comment
  39. Direct link to this comment
  40. Answers (0)
  41. See Also
  42. Categories
  43. Products
  44. Release
  45. Community Treasure Hunt
  46. How to Get Best Site Performance
  47. Americas
  48. Europe
  49. Asia Pacific
  50. Error: Sample points must be unique and sorted in ascending order.
  51. Direct link to this question
  52. Direct link to this question
  53. Accepted Answer
  54. Direct link to this answer
  55. Direct link to this answer
  56. More Answers (0)
  57. See Also
  58. Categories
  59. Products
  60. Release
  61. Community Treasure Hunt
  62. How to Get Best Site Performance
  63. Americas
  64. Europe
  65. Asia Pacific

Error: Sample points must be unique and sorted in ascending order.

Direct link to this question

Direct link to this question

0 Comments

Accepted Answer

Direct link to this answer

Direct link to this answer

0 Comments

More Answers (0)

See Also

Categories

Products

Release

Community Treasure Hunt

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

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Читайте также:  Error your local changes would be overwritten by revert

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

Europe

  • 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)

Asia Pacific

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

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Источник

Error: Sample points must be unique and sorted in ascending order.

Direct link to this question

Direct link to this question

0 Comments

Accepted Answer

Direct link to this answer

Direct link to this answer

0 Comments

More Answers (0)

See Also

Categories

Products

Release

Community Treasure Hunt

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

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Читайте также:  Ucode loading error что это

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

Europe

  • 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)

Asia Pacific

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

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Источник

Internal math error when using interpolation

Direct link to this question

Direct link to this question

2 Comments

Direct link to this comment

Direct link to this comment

Direct link to this comment

Direct link to this comment

Answers (0)

See Also

Categories

Products

Release

Community Treasure Hunt

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

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

Europe

  • 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)

Читайте также:  Teyes spro слетела прошивка

Asia Pacific

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

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Источник

Error: Sample points must be unique and sorted in ascending order.

Direct link to this question

Direct link to this question

0 Comments

Accepted Answer

Direct link to this answer

Direct link to this answer

0 Comments

More Answers (0)

See Also

Categories

Products

Release

Community Treasure Hunt

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

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Translated by

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

Europe

  • 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)

Asia Pacific

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

Accelerating the pace of engineering and science

MathWorks è leader nello sviluppo di software per il calcolo matematico per ingegneri e ricercatori

Источник

JanaK

Newbie
Posts: 3
Joined: Tue Jan 11, 2022 5:13 am

error: eprload with matlab 2021b

Hi,

while trying to use eprload for an xml-file in 2021b following bug showed itself:

eprload
Error using matlab.internal.math.interp1
Interpolation requires at least two sample points for each grid dimension.
Error in interp1 (line 188)
VqLite = matlab.internal.math.interp1(X,V,method,method,Xqcol);
Error in eprload_MagnettechXML
Error in eprload

We tried easyspin 5.2.33 as well as 6.xxx in 2021b, but none of them worked.
The script works in 2018b, 2019b and 2020b though. (5.2.33, 6.xxx)

We think the problem lies in Matlab 2021b in the script of interp1 around line 188 «VqLite».

Thanks for your help,
kind regards from Halle, Germany!

Silvio

User
Posts: 10
Joined: Mon Oct 16, 2017 8:37 am

Re: error: eprload with matlab 2021b

Post

by Silvio » Wed Jan 19, 2022 7:51 am

Hi,
I experience the same problem with 2021b. However, after investigating the eprload function, I think the problem lies in the base64 decoding of the data and not in interp1.

The base64 decoding of the curves and subsequent typecasting to double returns just a scalar (line 96-98 in eprload_MagnettechXML.m), therefore interp1 (doing an interpolation) throws the error that at least two sample points are needed for each dimension.

Unfortunately, I am no expert in base64 decoding and the underlying Java functions, so I am afraid I don’t know how to fix the bug.

Best,
Silvio

Stefan Stoll

EasySpin Creator
Posts: 971
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: error: eprload with matlab 2021b

Post

by Stefan Stoll » Fri Jan 21, 2022 1:03 am

Thanks. This is an incompatibility that R2021b introduced. The cause is clear, but it’s unclear how to fix this without making the loading really slow. See the issue on GitHub.

D F

  • Direct link to this question

 ⋮ 

  • Direct link to this question

I have a text file that has been plotted and I need to find the x value from a known y value. However there isn’t a data point at this point so I have interpolated. This has worked for some txt files but not others.

ymax = max(y);

xmax = find(y == ymax);

xmax = x(xmax);

yhalfmax = max(y)/2;

xhalfmax = interp1(y, x, yhalfmax, ‘spline’); %interpolate to generate a point at the yhalfmax point

Error: Error using gridded Interpolant. The grid vectors must contain unique points.

I have tried using ‘unique’ but this has changed the plotting so can’t be used.

  2 个评论

Matt J

此评论的直接链接

I have tried using ‘unique’ but this has changed the plotting so can’t be used.

How can it «change the plotting», if all you’ve done is throw away duplicate points?

D F

此评论的直接链接

When the following is used to replace the interp1 line above, the curve changes shape. I’m unsure why this would change the plot curve unless it is deleting usefull data points

[x, index] = unique(y); xhalfmax = interp1(y(index), x,yhalfmax, ‘linear’);

请先登录,再进行评论。


回答(1 个)

Star Strider

  • 此回答的直接链接

My usual approach to the problem of non-unique independent variable values for interp1 is to add a very small, increasing value to each element.

Example

XData = sort(randi(9, 1, 10)) % Create Data

XDataUnique = XData + linspace(0, 1, length(XData))*1E-3 % Add Increments To Each Element

I used ‘1E-3’ here to illustrate the idea. In practice, I use a much smaller multiplier, ‘1E-10’ or so.

  4 个评论

D F

此评论的直接链接

Thanks but this is unfortunately still giving the same error. I have tried to just straight forwardly multiply the interpolated data by 1.001 to make sure it doesn’t duplicate the normal x,y data but this has still failed

Star Strider

此评论的直接链接

My pleasure.

You have to add an increasing vector of small values to the data with duplicate entries to eliminate the problem with non-unique values. Adding a single scalar value to each element changes nothing.

Run my code to see how it works.

D F

此评论的直接链接

Aaah okay that makes sense! I have run the code and it is still returning the same error.

I then exchanged the x in the interp1 line of my code for XDataUnique however the index exceeded the matrix dimension, any thoughts?

Star Strider

此评论的直接链接

Looking at your code, it seems that you need to use it to create your ‘y’ data to do your interpolation, not your ‘x’ data.

Try this:

y = sort(randi(9, 1, 10)) % Create Data

YDataUnique = y + linspace(0, 1, length(y))*1E-3 % Add Increments To Each Element

I honestly have no idea what is causing the index error. The vector size should not change with my code.

请先登录,再进行评论。

发生错误

由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。

Translated by Microsoft

MathWorks - Domain Selector

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error writing configuration file pcsx2 как исправить
  • Error using edge expected input number 1 i to be two dimensional
  • Error yaml parser parsererror while parsing a block mapping
  • Error write epipe
  • Error ur is not detected please check the connection and reboot this software

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии