Filter löschen
Filter löschen

interp1 and spline error

2 Ansichten (letzte 30 Tage)
Mudasir Ahmed
Mudasir Ahmed am 30 Jun. 2015
Kommentiert: Image Analyst am 30 Jun. 2015
hi
i want to plot following series of values with respect to m which is (0:0.1:1). by connecting them in a sequence where n=1:11 K(n,:)=[m angle(n,1)]
30.7718
30.1766
27.9563
29.3494
30.5871
31.0456
47.2866
29.2492
27.7123
30.8852
33.4237
i have written the following program but gives no desired results
t = 0:.1:m;
x = K(:,1);
y = K(:,2)
tq = 1:0.01:m;
x1q = interp1(t,x,tq,'spline');
y1q = interp1(t,y,tq,'spline');
plot(x1q,y1q)
axis([0 1 0 100])
grid
kindly can any one rectify the error, thanks
  1 Kommentar
Image Analyst
Image Analyst am 30 Jun. 2015
What's that list of numbers for?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Thorsten
Thorsten am 30 Jun. 2015
K = [
0 34.4707
0.1000 29.2219
0.2000 33.9285
0.3000 30.2549
0.4000 27.5845
0.5000 30.1280
0.6000 35.3399
0.7000 27.2709
0.8000 30.4285
0.9000 41.8381
1.0000 31.5142];
x = K(:,1);
y = K(:,2);
xfine = linspace(x(1), x(end), 100);
yin = interp1(x, y, xfine, 'spline');
plot(x, y, '-o')
hold on
plot(xfine, yin, 'r-')

Weitere Antworten (1)

Torsten
Torsten am 30 Jun. 2015
My guess is that you mean
tq = 0:0.01:m;
instead of
tq = 1:0.01:m;
Best wishes
Torsten.
  1 Kommentar
Mudasir Ahmed
Mudasir Ahmed am 30 Jun. 2015
sir it gives error
Error in interp1 (line 191) F = griddedInterpolant(X,V,method);

Melden Sie sich an, um zu kommentieren.

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by