Clear Filters
Clear Filters

How to find the in-between value from a array to get corresponding value from 360*2 matrix

2 views (last 30 days)
How to find the in-between value from a array to get corresponding value from 360*2 matrix. SO if I have an angle of 178.4 , I would like to find out corresponding gain from the array.The gain will be in between 5.6 and 5.8 from the table.
array=[ %angle and gain table
180.0 5.9
179.0 5.8
178.0 5.6
177.0 5.5
176.0 5.1
175.0 4.6
174.0 4.2
173.0 3.5
172.0 2.8
171.0 1.7
170.0 0.5
169.0 -0.9
168.0 -2.8
167.0 -3.9
166.0 -5.3
165.0 -6.4
164.0 -8.3
163.0 -10.1
162.0 -13.9
161.0 -17.6
160.0 -25.7
159.0 -23.2
158.0 -18.0
157.0 -13.4
156.0 -10.6
155.0 -9.3
154.0 -8.8
153.0 -8.5
152.0 -8.6
151.0 -9.4
150.0 -10.5
149.0 -13.1
148.0 -15.9
147.0 -23.7
146.0 -32.1
145.0 -22.4
144.0 -19.1
143.0 -17.1
142.0 -16.3
141.0 -14.9
140.0 -13.4
139.0 -12.1
138.0 -11.2
137.0 -9.9
136.0 -9.1
135.0 -8.8
134.0 -8.4
133.0 -8.2
132.0 -8.1
131.0 -8.2
130.0 -8.5
129.0 -8.7
128.0 -9.2
127.0 -9.6
126.0 -9.9
125.0 -10.5
124.0 -10.9
123.0 -11.9
122.0 -13.2
121.0 -14.3
120.0 -15.4
119.0 -16.5
118.0 -17.8
117.0 -17.9
116.0 -17.4
115.0 -17.1
114.0 -15.7
113.0 -14.8
112.0 -13.6
111.0 -12.8
110.0 -12.0
109.0 -11.6
108.0 -11.0
107.0 -10.5
106.0 -10.4
105.0 -10.4
104.0 -10.4
103.0 -10.6
102.0 -10.8
101.0 -11.0
100.0 -11.4
99.0 -12.2
98.0 -12.5
97.0 -13.2
96.0 -13.9
95.0 -14.8
94.0 -15.4
93.0 -16.4
92.0 -16.9
91.0 -18.3
90.0 -19.4
89.0 -20.9
88.0 -22.0
87.0 -23.5
86.0 -24.1
85.0 -24.8
84.0 -24.2
83.0 -23.3
82.0 -22.4
81.0 -21.0
80.0 -19.2
79.0 -18.6
78.0 -17.3
77.0 -16.5
76.0 -15.8
75.0 -15.5
74.0 -15.6
73.0 -15.5
72.0 -15.4
71.0 -15.7
70.0 -16.1
69.0 -15.9
68.0 -15.9
67.0 -15.7
66.0 -15.4
65.0 -15.2
64.0 -14.8
63.0 -14.6
62.0 -14.4
61.0 -14.0
60.0 -13.7
59.0 -13.5
58.0 -13.2
57.0 -12.6
56.0 -11.8
55.0 -11.1
54.0 -9.9
53.0 -9.1
52.0 -8.2
51.0 -7.7
50.0 -7.4
49.0 -7.4
48.0 -7.8
47.0 -8.3
46.0 -9.5
45.0 -10.6
44.0 -12.7
43.0 -14.7
42.0 -16.1
41.0 -16.1
40.0 -15.4
39.0 -14.3
38.0 -13.9
37.0 -14.1
36.0 -15.1
35.0 -17.2
34.0 -20.5
33.0 -31.9
32.0 -28.4
31.0 -17.4
30.0 -14.2
29.0 -10.9
28.0 -9.5
27.0 -8.4
26.0 -8.2
25.0 -8.6
24.0 -9.2
23.0 -10.8
22.0 -12.1
21.0 -15.5
20.0 -18.7
19.0 -20.4
18.0 -16.0
17.0 -10.6
16.0 -7.9
15.0 -5.2
14.0 -3.6
13.0 -1.8
12.0 -0.7
11.0 0.7
10.0 1.5
9.0 2.3
8.0 3.0
7.0 3.6
6.0 4.3
5.0 4.6
4.0 5.1
3.0 5.4
2.0 5.6
1.0 5.9
0.0 6.0
-1.0 5.9
-2.0 5.8
-3.0 5.5
-4.0 5.3
-5.0 4.9
-6.0 3.7
-7.0 3.0
-8.0 2.4
-9.0 1.6
-10.0 0.3
-11.0 -0.7
-12.0 -2.4
-13.0 -4.2
-14.0 -4.4
-15.0 -5.3
-16.0 -5.7
-17.0 -5.7
-18.0 -5.2
-19.0 -5.1
-20.0 -5.0
-21.0 -4.9
-22.0 -4.7
-23.0 -4.4
-24.0 -4.4
-25.0 -4.3
-26.0 -4.7
-27.0 -5.0
-28.0 -5.8
-29.0 -7.0
-30.0 -7.9
-31.0 -9.2
-32.0 -10.9
-33.0 -11.3
-34.0 -11.5
-35.0 -10.6
-36.0 -9.2
-37.0 -8.5
-38.0 -7.8
-39.0 -7.9
-40.0 -7.9
-41.0 -8.9
-42.0 -10.0
-43.0 -11.7
-44.0 -13.3
-45.0 -14.1
-46.0 -12.6
-47.0 -11.4
-48.0 -9.9
-49.0 -8.7
-50.0 -7.9
-51.0 -7.6
-52.0 -7.7
-53.0 -8.0
-54.0 -8.4
-55.0 -9.2
-56.0 -10.0
-57.0 -11.4
-58.0 -12.5
-59.0 -14.7
-60.0 -16.6
-61.0 -19.8
-62.0 -25.1
-63.0 -29.2
-64.0 -24.3
-65.0 -20.9
-66.0 -18.0
-67.0 -15.6
-68.0 -13.3
-69.0 -12.1
-70.0 -11.0
-71.0 -10.3
-72.0 -9.5
-73.0 -9.5
-74.0 -9.1
-75.0 -9.0
-76.0 -8.9
-77.0 -9.1
-78.0 -9.4
-79.0 -9.5
-80.0 -10.0
-81.0 -10.9
-82.0 -11.2
-83.0 -11.9
-84.0 -12.5
-85.0 -13.4
-86.0 -14.2
-87.0 -15.7
-88.0 -17.6
-89.0 -18.7
-90.0 -21.3
-91.0 -23.8
-92.0 -25.4
-93.0 -25.0
-94.0 -22.7
-95.0 -20.6
-96.0 -19.3
-97.0 -17.5
-98.0 -16.1
-99.0 -15.2
-100.0 -14.6
-101.0 -14.0
-102.0 -13.2
-103.0 -12.8
-104.0 -12.6
-105.0 -12.0
-106.0 -11.8
-107.0 -11.6
-108.0 -11.8
-109.0 -12.1
-110.0 -12.4
-111.0 -13.0
-112.0 -13.6
-113.0 -14.0
-114.0 -14.8
-115.0 -15.7
-116.0 -16.3
-117.0 -17.1
-118.0 -17.8
-119.0 -17.7
-120.0 -16.7
-121.0 -15.1
-122.0 -13.5
-123.0 -12.4
-124.0 -11.2
-125.0 -10.7
-126.0 -10.1
-127.0 -10.0
-128.0 -10.1
-129.0 -10.3
-130.0 -10.7
-131.0 -11.5
-132.0 -12.2
-133.0 -12.5
-134.0 -12.3
-135.0 -12.1
-136.0 -10.8
-137.0 -9.9
-138.0 -9.3
-139.0 -8.7
-140.0 -8.4
-141.0 -8.1
-142.0 -7.9
-143.0 -8.0
-144.0 -8.3
-145.0 -8.6
-146.0 -8.9
-147.0 -8.6
-148.0 -8.2
-149.0 -7.3
-150.0 -6.6
-151.0 -5.7
-152.0 -5.4
-153.0 -5.1
-154.0 -4.8
-155.0 -4.5
-156.0 -4.3
-157.0 -4.0
-158.0 -3.9
-159.0 -3.7
-160.0 -3.7
-161.0 -3.9
-162.0 -4.2
-163.0 -4.8
-164.0 -5.1
-165.0 -5.4
-166.0 -5.0
-167.0 -3.8
-168.0 -2.1
-169.0 -0.9
-170.0 0.6
-171.0 1.3
-172.0 2.4
-173.0 3.0
-174.0 3.7
-175.0 4.9
-176.0 5.3
-177.0 5.5
-178.0 5.7
-179.0 5.9]

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 7 Dec 2015
Edited: Andrei Bobrov on 7 Dec 2015
out = interp1(array(:,1),array(:,2),178.4)

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!