I have a matrix with 161*2 with one column as distance to say x- axis and y- axis to be corresponding height. But I would like to scale the x-axis to 10000 points and I want particular height at a particular distance?

1 次查看(过去 30 天)
-40 5
-39 5
-38 5
-37 5
-36 5
-35 5
-34 5
-33 5
-32 5
-31 5
-30 5
-29 5
-28 5
-27 5
-26 5
-25 5
-24 5
-23 5
-22 5
-21 5
-20 5
-19 5
-18 5
-17 5
-16 5
-15 5
-14 5
-13 5
-12 5
-11 5
-10 5
-9 5
-8 5
-7 5
-6 5
-5 5
-4 5
-3 5
-2 5
-1 5
0 5
1 5
2 5
3 5
4 5
5 5
6 5
7 5
8 5
9 5
10 5
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0.0500
22 0.1000
23 0.1500
24 0.2000
25 0.2500
26 0.3000
27 0.3500
28 0.4000
29 0.4500
30 0.5000
31 0.5500
32 0.6000
33 0.6500
34 0.7000
35 0.7500
36 0.8000
37 0.8500
38 0.9000
39 0.9500
40 1.0000
41 1.0500
42 1.1000
43 1.1500
44 1.2000
45 1.2500
46 1.3000
47 1.3500
48 1.4000
49 1.4500
50 1.5000
51 1.5500
52 1.6000
53 1.6500
54 1.7000
55 1.7500
56 1.8000
57 1.8500
58 1.9000
59 1.9500
60 2.0000
61 1.9667
62 1.9333
63 1.9000
64 1.8667
65 1.8333
66 1.8000
67 1.7667
68 1.7333
69 1.7000
70 1.6667
71 1.6333
72 1.6000
73 1.5667
74 1.5333
75 1.5000
76 1.4667
77 1.4333
78 1.4000
79 1.3667
80 1.3333
81 1.3000
82 1.2667
83 1.2333
84 1.2000
85 1.1667
86 1.1333
87 1.1000
88 1.0667
89 1.0333
90 1.0000
91 0.9667
92 0.9333
93 0.9000
94 0.8667
95 0.8333
96 0.8000
97 0.7667
98 0.7333
99 0.7000
100 0.6667
101 0.6333
102 0.6000
103 0.5667
104 0.5333
105 0.5000
106 0.4667
107 0.4333
108 0.4000
109 0.3667
110 0.3333
111 0.3000
112 0.2667
113 0.2333
114 0.2000
115 0.1667
116 0.1333
117 0.1000
118 0.0667
119 0.0333
120 2.0000e-06
suppose I need a point in between 118 and 119 ? what should I do to scale the x-axis?

回答(1 个)

Guillaume
Guillaume 2015-12-13
编辑:Guillaume 2015-12-13
heightdistance = [116 0.1333; 117 0.1; 118 0.0667; 120 2e-6]; %other points omitted for brevity
queryheight = 118.2;
distance = interp1(heightdistance(:, 1), heightdistance(:, 2), queryheight)
If you want the distances at 10000 heights between -40 and 120:
heights = linspace(-40, 120, 10000)';
distances = interp1(heightdistance(:, 1), heightdistance(:, 2), heights);
newheightdistance = [heights, distances];

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by