Is it possible to make a linear interpolation between 2 curves ? note the abscissa are not necessary exactly the same ...
In particular terms, I've a curve one at temperature X and another one at température Y and I would like to have (and to plot) temperature at temperature Z in-between X-Y ... (see attachment)
I had a look in interp, interp1 and interpln but nothing sound useful for me ... Am I wrong ?
Thanks for any advice
-------------------------------------------------------------------------------- Le présent mail et ses pièces jointes sont confidentiels et destinés à la personne ou aux personnes visée(s) ci-dessus. Si vous avez reçu cet e-mail par erreur, veuillez contacter immédiatement l'expéditeur et effacer le message de votre système. Toute divulgation, copie ou distribution de cet e-mail est strictement interdite. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email.
On 17/09/2012 09:53, Carrico, Paul wrote:
You should have a look at ndgrid and cshep2d.
Here is a bit a script we use to interpolate scattered data on a grid:
tl_coef = cshep2d([x y z]);
// evaluation on a grid
m = 50;
X = linspace(min(x),max(x),m);
Y = linspace(min(y),max(y),m);
[xx,yy] = ndgrid(X,Y);
// interpolation bicubique pour intuiter les valeurs
Z = eval_cshep2d(xx,yy, tl_coef);
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Antoine Monmayrant LAAS - CNRS 7 avenue du Colonel Roche 31077 TOULOUSE Cedex 4 FRANCE Tel:+33 5 61 33 64 59 email : [hidden email] permanent email : [hidden email] +++++++++++++++++++++++++++++++++++++++++++++++++++++++
users mailing list
In reply to this post by Carrico, Paul
Assuming the relationship between x, y and T is approximately linear, then you can just match the points on the curves pairwise and interpolate between the pairs using interpln. If your target temperature T is such that T = aT1 + (1-a)T2, then it will produce a point at abscissa x = ax1 + (1-a)x2 and ordinate y = ay1 + (1-a)y2, where (x1,y1) and (x2,y2) are one of the pairs of points. You can build up the two x and y vectors and plot using plot2d.
This is usually only useful between your two temperatures (interpolation) and is of limited accuracy outside (extrapolation), but that depends...
If you need to get the result on a defined abscissa grid, then you can interpolate in the x and y directions separately, noting that sometimes it makes a difference which order you do this in. Depending on the spacing of your x points, a linear interpolation in the x direction may not be accurate enough. In that case, I would use for example a Lagrange interpolation.
users mailing list
|Free forum by Nabble||Edit this page|