# 3 independent variable regression.

31 次查看（过去 30 天）
Julia Hoskins2020-9-10

I'm trying to fit a function with 3 independent variables and 1 dependent. I have all of the data and I've tried a few methods but nothing works.
I want a function set up so that the result would be F where F = f(x,y,z). Developing a model from a matrix of [ x, y, z, F] values. Any suggestions?
To clarify, I don't need to plot it (yet if ever).
##### 3 个评论显示隐藏 2更早的评论
Karen Hejazi 2021-7-11
% Q, H and Theta are the three independent variables
Q = [0.5;0.6;0.8;0.9;0.99;1;1;1;1.2;1.2;1.2;1.2;1.5;1.5;1.6;1.8;2;2.3;2.5;2.5;2.8;3.2;3.5;4.5;5.5;6;6;7.1;8];
H = [5;5.3;1.35;2.1;1.05;3.16;3;5;3.57;1.75;3.2;1;3;3.17;1.1;3.45;1.8;2.55;2.55;1.8;2.1;3.6;4.05;1.5;5;5.8;2.97;1.7;1.73];
Theta = [28.5;31.2;25;21.6;20.3;25.2;30;28.9;21.8;22.8;28.7;18.8;20.2;22;20.6;21.5;21.9;22.8;20.4;21.1;19.2;26.4;24.5;17.2;22.9;22.3;25.8;22;19.2];
% Eff is the dependent variable
Eff = [64.8;60.9;70.8;75;71.6;67.7;71.4;67.3;69;67.5;71.5;68;74.8;70.7;73;75.5;73.6;76.5;73.2;70.2;74.5;70.8;70.5;72.6;71.2;73.2;74.4;70.9;72.9];
i want a function for Eff(Q,H,Theta)

### 回答（1 个）

Ameer Hamza 2020-9-10
There are several ways to solve such problems in MATLAB. If you have the curve fitting toolbox, then you can use fit(): https://www.mathworks.com/help/releases/R2020a/curvefit/fit.html
Alternatively, you can also use functions from optimization toolbox
##### 3 个评论显示隐藏 2更早的评论
Julia Hoskins 2020-9-11
Yeah, but my F values are an equally sized array and not a function, so the fitting doesn't work.

### Community Treasure Hunt

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

Start Hunting!

Translated by