How can I interpolate a set of non-uniform data [x,y] to match another set of non-uniform data [y,z] so I can get [x,z] and [y,z] at the same z values?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Keenan Barazi
am 5 Dez. 2020
Bearbeitet: Cris LaPierre
am 8 Mär. 2021
I am digitizing data from two plots. What I need is Lift vs Angle and Drag vs Angle. The plots I have are Lift vs Angle and Drag vs Lift. In theory there should be enough information there for me to get what I need, but I'm struggling. I tried a simple interp1 function and got NaNs as well as values that clearly didn't make sense:
cd = interp1(clcd(:,1),clcd(:,2),avscl(:,2)
where clcd is a 67x2 matrix with lift in the first column and drag in the second, and avcl is a matrix with angle in the first column and lift in the second (I also tried reordering the lift values from the avscl in increasing order to match the lift axis in the Lift vs Drag curve but predictably just got the same values in a different order). And I also tried to resample to get drag at evenly spaced lift values but just got a single constant value:
resample(clcd(:,2),clcd(:,1),f)
where f was something like 1/10 or 1/100 etc...
I attached my workspace as well as the curves I am digitizing from so you can see what I mean (it's the top two plots in the picture, and clincr is lift in increasing order).
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 6 Dez. 2020
Bearbeitet: Cris LaPierre
am 8 Mär. 2021
interp1 is designed to work with the independent variable (angle here), but to get what you want, you would need to interpolate using lift, the dependent variable. This causes a problem because, at least in avscl, your values first increase then decrease. This means that for some values of lift, there are 2 possible angles. Although intuitivey you can identify which values to use, MATLAB does not "see" this. interp1 works as a table lookup.
Sorting by lift does not help because that distorts the shape of the curve.
The NaNs are because the first 13 values of lift in clcd are outside the range of lift values in avscl. You can tell interp1 to extrapolate to find values for these.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!