3D lut with breakpoint not monotonically increasing

5 次查看(过去 30 天)
Hello, I have to built a n-D LUT having these data (33x4 matrix) in which each row represent an operative point
Cn=[28.8256 13.7067 2.0250 56.1982
30.0462 13.7263 2.0250 60.3673
33.2230 13.8436 2.0250 70.3963
35.9034 13.7947 2.0250 80.1739
31.2822 12.8757 2.9250 53.1086
33.1786 12.9930 2.9250 55.3209
37.3316 13.1201 2.9250 58.0397
40.4454 13.1983 2.9250 62.2023
43.1929 13.2668 2.9250 70.4441
45.5684 13.2179 2.9250 80.2180
31.0773 12.4553 4.0500 52.1194
31.8684 12.4260 4.0500 57.2540
32.7861 12.4846 4.0500 61.1600
35.0422 12.4846 4.0500 66.0019
37.9732 12.5628 4.0500 72.0352
42.2481 12.6899 4.0500 81.0484
46.5210 12.7779 4.0500 90.3163
55.4512 12.1425 4.0500 100.3494
33.7675 11.4288 4.9500 57.2851
34.6868 11.5168 4.9500 60.0202
35.8479 11.5656 4.9500 63.3296
40.1259 11.7514 4.9500 70.3828
45.7397 11.8296 4.9500 80.1534
48.3678 11.9469 4.9500 90.3553
55.1833 11.6830 4.9500 100.2997
35.5687 10.8911 6.0750 60.0815
36.6729 11.0182 6.0750 63.2371
38.7532 11.1550 6.0750 64.9336
42.5491 11.4483 6.0750 68.2462
45.8443 11.4972 6.0750 70.2852
47.6787 11.5950 6.0750 80.0480
50.0009 11.6927 6.0750 90.3316
54.9901 11.4874 6.0750 100.1905]
I interpolate this data for having more points:
[Xq,Yq,Zq] = meshgrid(linspace(min(Cn(:,1)),max(Cn(:,1)),33),linspace(min(Cn(:,2)),max(Cn(:,2)),33),linspace(min(Cn(:,3)),max(Cn(:,3)),33));
vq = griddata(Cn(:,1)',Cn(:,2)',Cn(:,3)',Cn(:,4)',Xq,Yq,Zq,'nearest');
and finally I built LUT with: Breakpoint Cn(:,1)',Cn(:,2)',Cn(:,3)' and Table: vq
Matlab gives me error: Values of 'BreakpointsForDimension2' in 'nd/2-D Lookup Table' must be strictly monotonically increasing. The problem occurs at element 2-4-5.

回答(1 个)

Walter Roberson
Walter Roberson 2022-6-12
Your marginals used as breakpoints in your Simulink lookup table should be
linspace(min(Cn(:,1)),max(Cn(:,1)),33)
linspace(min(Cn(:,2)),max(Cn(:,2)),33)
linspace(min(Cn(:,3)),max(Cn(:,3)),33)
You will recognize those as being the exact same as the vectors used to construct the meshgrid
Note: you might possibly need to exchange the first two coordinates, as I suspect that the first breakpoint list should correspond to rows rather than corresponding to x. In MATLAB, x is columns and rows is y.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by