Using interp1 with semilog dataset

18 次查看(过去 30 天)
I have 3 arrays:
  • 'Dose' contains 27 values ranging from 1x10^2 to 1x10^6
  • 'AlThick' contains 27 values ranging from 0.0001 to 20
  • 'Rays' contains 10000 values ranging from 0 to 20
The points in each data set are not equally spaced. Dose represents y values; AlThick and Rays both represent x values. I want to find the value of Dose for each non-zero value of Rays. I am doing the following and getting, as expected, 10000 values.
DoseMat = interp1(AlThick, Dose, rays(rays>0), 'linear')
However, I'm not sure if I need to be accounting for the fact that the y-axis data is plotted as a base-10 logarithm. I.e. it is a semilog plot with base-10 log values on the y-axis and linear values on the x-axis, as shown below.
Any advice is appreciated!
  2 个评论
Torsten
Torsten 2022-8-31
编辑:Torsten 2022-8-31
And plotting "Dose" against "AlThick" in semilogy gives you a linear relationship ?
Could you include this plot ?
Alex
Alex 2022-8-31
I have updated the OP with the plot of Dose vs AlThick

请先登录,再进行评论。

采纳的回答

Cris LaPierre
Cris LaPierre 2022-8-31
编辑:Cris LaPierre 2022-8-31
You do not need to take account of the fact that you are plotting your data in a semilog plot. That doesn't impact how you would interpolate the data. The 'linear' here is the interpolation method.
However, you are not using interp1 correctly. Interp1 is for (x,y) data. The syntax is
  • newY = interp1(knownX, knownY, newX, method).
You probably want to use interp2.
  • newZ = interp1(knownX, knownY, knownZ, newX, newY, method).
  4 个评论
Alex
Alex 2022-8-31
I've updated the OP with the plot of Dose vs AlThick

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by