finding a function with 4 variables

Hello, for a project im doing I measured the hight of rising dough as im playing with 3 variables (flour sugar yeast). and so I ended up having 4 vectors.
how can I fit a function to this data? (i.e hegiht =f(sugar,yeast,flour))

4 个评论

What kind of function f do you think is appropriate ?
I honestly have no idea, lets say somthing with x^2,y^2,z^2
Since you have collected the data, maybe the batch least squares estimation?
You can find mre info here:

请先登录,再进行评论。

 采纳的回答

I suggest you start with
height = a + b * sugar + c * yeast + d * flour
If height,sugar, yeast and flour are column vectors of equal length, this would give the code
sol = [ones(numel(height),1),sugar,yeast,flour]\height
a = sol(1)
b = sol(2)
c = sol(3)
d = sol(4)
for the regression coefficients a, b, c and d.

5 个评论

thank you!, ill give this a go
I tried this, this is my code:
numOfExp = 1:31;
mLFlour = [15,15,15,15,15,15,15,22.5,22.5,22.5,22.5,22.5,22.5,30,30,30,30,30,30,37.5,37.5,37.5,37.5,45,45,45,52.5,52.5,52.5,60,60];
mLYeast = [7.5,15,22.5,30,37.5,45,52.5,7.5,15,22.5,30,37.5,45,7.5,15,22.5,30,37.5,45,7.5,15,22.5,30,7.5,15,22.5,22.5,15,7.5,7.5,15];
mLSugar = [52.5,45,37.5,30,22.5,15,7.5,45,37.5,30,22.5,15,7.5,37.5,30,22.5,15,7.5,0,30,22.5,15,7.5,22.5,15,7.5,0,7.5,15,7.5,0];
RisingHeightCm = [3,3.5,4.3,4.1,7.9,5.9,4,3.1,2.6,3.2,7.1,7.9,4.9,2.5,2.6,5,8,3.9,4.3,2.8,4.5,10.6,4.5,2.6,5.6,3.7,4.2,5.7,6,5.6,4.5];
BakingHeightCm = [3.9,6,6.6,6.5,5.7,5.9,3.4,4.9,5.5,5.8,9.4,5.6,4.7,4,5.5,7.6,9.5,3.8,4,5.4,7.1,4.8,4.6,5.6,8.7,4.3,4.1,5.5,7.9,6.8,4.6];
sol = [ones(numel(RisingHeightCm),1),mLSugar,mLYeast,mLFlour]\RisingHeightCm;
a = sol(1);
b = sol(2);
c = sol(3);
d = sol(4);
but I get the error "Dimensions of arrays being concatenated are not consistent.", all the vectors are 1X31
I wrote column vectors, not row vectors.
numOfExp = 1:31;
mLFlour = [15,15,15,15,15,15,15,22.5,22.5,22.5,22.5,22.5,22.5,30,30,30,30,30,30,37.5,37.5,37.5,37.5,45,45,45,52.5,52.5,52.5,60,60].';
mLYeast = [7.5,15,22.5,30,37.5,45,52.5,7.5,15,22.5,30,37.5,45,7.5,15,22.5,30,37.5,45,7.5,15,22.5,30,7.5,15,22.5,22.5,15,7.5,7.5,15].';
mLSugar = [52.5,45,37.5,30,22.5,15,7.5,45,37.5,30,22.5,15,7.5,37.5,30,22.5,15,7.5,0,30,22.5,15,7.5,22.5,15,7.5,0,7.5,15,7.5,0].';
RisingHeightCm = [3,3.5,4.3,4.1,7.9,5.9,4,3.1,2.6,3.2,7.1,7.9,4.9,2.5,2.6,5,8,3.9,4.3,2.8,4.5,10.6,4.5,2.6,5.6,3.7,4.2,5.7,6,5.6,4.5].';
BakingHeightCm = [3.9,6,6.6,6.5,5.7,5.9,3.4,4.9,5.5,5.8,9.4,5.6,4.7,4,5.5,7.6,9.5,3.8,4,5.4,7.1,4.8,4.6,5.6,8.7,4.3,4.1,5.5,7.9,6.8,4.6].';
sol = [mLSugar,mLYeast,mLFlour]\RisingHeightCm;
a = sol(1)
a = 0.0270
b = sol(2)
b = 0.0948
c = sol(3)
c = 0.0646
error = [mLSugar,mLYeast,mLFlour]*sol - RisingHeightCm
error = 31×1
0.1000 0.1086 -0.1829 0.5257 -2.7657 -0.2571 2.1514 0.2819 1.2905 1.1990
I remember making dough.
Did you miss Salt and Warm Water as parts of the ingredients?
The temperature of the water is also sort of important. If it is too hot, then it will kill the yeast.
I think yeast is a kind of fungus.
By the way, does the baker's mixing skill influence the rising height of the dough?

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Timing and presenting 2D and 3D stimuli 的更多信息

产品

版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by