Vector creation with information of other vector
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a question about the creation of a vector. On one hand, I have two vectors:
m1x= [550 560 562 562 645]
m1y= [0.003 0.0005 0.0008 0.0002 0.012]
And on the other hand, I have another one:
l1x= [560 580 562 546 524]
With m1x and m1y I've done a interpolation and I have values for each number from 550 to 645. I've saved that information in a new vector. The interpolation vector is like this:
a1x= [550 551 552 553 554 555 556 ...]
a2x= [0.002 0.02 0.002 0.06 0.08 0.07 ...]
My purpose is to create another vector and I want to obtain the y values from the l1x vector values (using the results of the interpolation vector). So, for example I want a vector like this:
l1x= [560 580 562 546 524]
l1y (this is the new vector)= [0.005 0.005 (this number is from the vector of interpolation) 0.0008...].
How can I indicate to the code that I want some specific numbers from the interpolation data to the new vector?
Greetings and thanks in advance,
Emma
0 Commenti
Risposta accettata
Andrei Bobrov
il 26 Set 2012
Modificato: Andrei Bobrov
il 26 Set 2012
m1x= [550 560 562 562 645];
m1x = m1x+[false, diff(m1x) == 0]*eps(1000);
pp = interp1(m1x,m1y,'linear','pp');
l1x= [560 580 562 546 524];
out = ppval(pp,l1x);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!