1
$\begingroup$

I have two vectors called lammdaWind11 and timeWind11. They are of size 51*1. I have interpolted each one independently as

lammdaWind11I = ListInterpolation[lammdaWind11];

and

timeWind11I = ListInterpolation[timeWind11];

However, I can find the values compared to the element of the vector. I want to put the time vector in the X axis and the lammda as the y variable so that I can know the value of the function for a certain time, not for an element of the vector. Unfortunately, I cannot find naything about this in the documentation. Can someone please tell me how to do it?

$\endgroup$
1
  • 1
    $\begingroup$ First you Transpose the two vectors, and plot points. Then you can use FindFit to find the best fit for your data. e.g. ylist = RandomInteger[{-10, 10}, 20] , xlist = RandomInteger[{-10, 10}, 20] and pts = Transpose[{xlist, ylist}] . $\endgroup$
    – Syed
    Nov 9, 2021 at 9:37

1 Answer 1

1
$\begingroup$

Some fake data

SeedRandom[42];
timeWind11=MovingAverage[Sort@RandomReal[1,51+9],10];
lammdaWind11=MovingAverage[RandomReal[1,51+9],10];

your current interpolations

lammdaWind11I = ListInterpolation[lammdaWind11];

timeWind11I = ListInterpolation[timeWind11];

Show[
ListPlot[{timeWind11,lammdaWind11},PlotStyle->{Red,Blue},PlotTheme->"Scientific"],
Plot[Evaluate@{timeWind11I[n],lammdaWind11I[n]},{n,1,51},PlotStyle->Thin]
]

enter image description here

My proposed solution uses Interpolation and arranges the data to the correct format using Transpose

enter image description here

if=Interpolation[Transpose@{timeWind11,lammdaWind11}];

Show[
 ListPlot[
  Transpose@{timeWind11,lammdaWind11}
  ,Joined->False
  ,PlotTheme->"Scientific"
 ],
 Plot[if[t],{t,Sequence@@MinMax[timeWind11]}]
]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.