-
Notifications
You must be signed in to change notification settings - Fork 0
/
kurva.m
60 lines (53 loc) · 1.06 KB
/
kurva.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Print nice Hermite curve between 2 points
clear all, close all, clc
% Define parameters
global uw
uw = 0;
h = 0.005;
u = start_vec(45, 19);
bana_big = RKode(u, h*2);
bana_small = RKode(u, h);
x1 = [];
y1 = [];
x2 = [];
y2 = [];
% Get interpolation for 2*h
for n = 1:length(bana_big.x) - 1
[x, y] = herm(bana_big, n);
x1 = [x1 x];
y1 = [y1 y];
hold on
end
% Get interpolation for h
for n = 1:length(bana_small.x) - 1
[x, y] = herm(bana_small, n);
x2 = [x2 x];
y2 = [y2 y];
hold on
end
% Plot full
subplot(2,1,1)
plot(x1,y1)
hold on
plot(x2,y2)
grid on
leg_big = sprintf('h=%0.3f', 2*h);
leg_small = sprintf('h=%0.3f', h);
title('Bana stycvis interpolerad med Hermite-interpolering')
legend({leg_big, leg_small})
xlabel('x [m]')
ylabel('y [m]')
hold off
% Plot zoomed
subplot(2,1,2)
plot(x1,y1)
hold on
plot(x2,y2)
grid on
leg_big = sprintf('h=%0.3f', 2*h);
leg_small = sprintf('h=%0.3f', h);
title('Bana stycvis interpolerad med Hermite-interpolering, zoomad')
legend({leg_big, leg_small})
xlabel('x [m]')
ylabel('y [m]')
axis([0 1 1.3 2])