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일

1 개 추천

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일
편집: Alex 2022년 8월 31일
Thank you for the fast reply. I think either I didn't explain myself properly in my original post, or I am misunderstanding your comment.
I believe my data is (x,y); AlThick is my x data and Dose is my y data. Rays is a set of 10000 values that represent different points on the x-axis (i.e. different values of AlThick), and I want to find the value of Dose for each of these 10000 points (unless it is 0, in which case it can be ignored).
Hopefully I'm explaining myself clearly!
Cris LaPierre
Cris LaPierre 2022년 8월 31일
No, you are good, I just didn't read your post carefully enough. Then your syntax is fine, and the first paragraph of my answer addresses your other concern.
Image Analyst
Image Analyst 2022년 8월 31일
@Alex, attaching data in a .mat file, and screenshots of it plotted, would help.
Alex
Alex 2022년 8월 31일
I've updated the OP with the plot of Dose vs AlThick

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2022년 8월 31일

편집:

2022년 8월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by