Interpolating numerical function of many variables
조회 수: 5 (최근 30일)
이전 댓글 표시
erictoleratesMATLAB
2023년 1월 20일
답변: erictoleratesMATLAB
2023년 1월 25일
Hi everyone,
I'm attempting to develop a lookup function/table based on a set of data.
This data describes the measured airflow through a fan as a function of the fan's PWM command and the position of various ducts in the system (airflow = f(PWM,Vent 1 position, Vent 2 position, Vent 3 position, Vent 4 position). This data only exists for configurations where each duct is either open or closed at 100%.
There are 4 ducts, (V, D, F, and S) and I have the airflow values at each combination of ducts open/closed and each PWM command. Assume that when the direction says something like 'V+F+D', all 3 ducts are open at 100%, and if a duct isn't specified (like S in this example) it is fully closed at 0%.
I would like the ability to specify something like (V open at 40%, S open at 20%, D fully closed, F open at 100%, PWM command = 50) and have the output be an interpolated airflow at this set of door conditions. I'm getting stuck trying to format the data in a way that makes the problem solvable. Any advice and tips would be appreciated!
Please find some sample data attached.
Here's what I have so far, but I haven't figured out how to interpolate at vent states I don't yet have data for.
pwm_values = [0, 24, 34, 44, 64, 85]; % [Val out of 85]
duct_openings = {'Off', 'V', 'F', 'D', 'S', 'V+F', 'V+S', 'V+D', 'F+S', 'F+D', 'S+D', 'V+F+S', 'V+F+D', 'V+D+S', 'F+D+S', 'V+F+D+S'};
airflow_matrix = [0 0 0 0 0 0;
0 80.05 96.175 112.6 146.65 171.55;
0 85.75 104.2 122.875 157.975 176.65;
0 92.575 111.1 130.975 165.175 183.625;
0 53.8 64.525 72.85 87.325 97.6;
0 100.975 126.775 154.075 213.55 240.4;
0 80.875 100.975 122.125 160.075 182.125;
0 95.575 121.75 146.875 193.6 226;
0 81.55 101.275 119.725 159.4 179.65;
0 102.55 132.25 160.525 208.825 232.75;
0 93.55 116.725 142.15 1680.4 194.95;
0 106.825 137.95 171.925 226.675 252.175;
0 114.4 147.925 184.525 243.55 271.075;
0 102.55 132.25 160.525 210.775 236.8;
0 97.45 128.425 156.325 210.775 236.8;
0 116.5 150.775 188.125 248.275 276.4;
];
% Create meshgrid of known vals
[X,Y] = meshgrid(pwm_values, 1:size(airflow_matrix,1));
% Transpose to format for griddedInterpolant
X = X';Y = Y';airflow_matrix = airflow_matrix';
% Create lookup entity
F = griddedInterpolant(X,Y,airflow_matrix,'linear');
% Define the PWM value and duct opening combination to test
pwm = 84;
duct_combination = 'V+D+S';
interp_airflow = F([pwm, find(strcmp(duct_openings,duct_combination))])
댓글 수: 3
Torsten
2023년 1월 21일
편집: Torsten
2023년 1월 21일
For example: What if the opening percentages for the ducts are V=50%,D=50%,F=100%,S=75% and PWM = 34?
And you are optimistic that you can capture such complicated interactions that might occur by percentage openings using a simple interpolation ?
Ok. But then you will have to define V, D, F, S and PWM as independent variables.
What would be an adequate model to get a correlation airflow = f(V,D,F,S,PVM) ?
You have measurements that take interactions between V, D, F and S into account. Thus the model should contain terms
V, D, F, S, V*F, V*S, V*D, F*S, F*D, S*D, V*F*S,V*F*D,V*D*S.
A third-order polynomial of the form
p0*V + p1*D + p2*F + p3*S + p02*V*F + p03*V*S + p01*V*D + p23*F*S + p21*F*D + p31*S*D + p023*V*F*S + p021*V*F*D + p013*V*D*S
comes to mind with coefficients p0,p1,...,p013 to be determined from your measurement data.
But how to integrate PVM here ?
채택된 답변
추가 답변 (1개)
Sulaymon Eshkabilov
2023년 1월 21일
You should consider here some sort of unit compatibe value for U, S, D, V. In other words, 100% (and 80%, 60%, 40%, 20%) open U corresponds to ??% of S opening, ??? % D and ??% of V or vice verse 100% open S corresponds to ?% of U, ?% D, ?%V. So then you shall be able to compute V+F, V+S, V+F+D, etc., make up the states of PWM.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Function Creation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!