generate vector from fixed point
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
matteo avanzi
am 30 Nov. 2017
Beantwortet: Jos (10584)
am 30 Nov. 2017
I have a 1x35 array, i want to generate a vector 1x31822 interpolating from the 35 points of the first vector, in a way that the two vectors could have the same shape.
which is the best method?
thanks
2 Kommentare
Jos (10584)
am 30 Nov. 2017
what do you mean by "have the same shape"? Can you give a small example?
Akzeptierte Antwort
KSSV
am 30 Nov. 2017
Read about interp1.
th = linspace(0,2*pi,35) ;
y = sin(th) ;
figure
hold on
plot(th,y,'.r')
%%interpolation
thi = linspace(min(th),max(th),31822) ;
yi = interp1(th,y,thi) ;
plot(thi,yi,'b') ;
0 Kommentare
Weitere Antworten (1)
Jos (10584)
am 30 Nov. 2017
interp1 is your friend. An example:
x = [0 4 7 10]
y = (x-5).^2
xx = linspace(0,10,13)
yy0 = interp1(x,y,xx) % default: linear interpolation
yy1 = interp1(x,y,xx,'pchip')
plot(xx,yy0,'r-',xx,yy1,'g-', x,y,'bo')
0 Kommentare
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!