How to Perform Multivariate Regression with Two Independent Variables on a Surface
15 ビュー (過去 30 日間)
古いコメントを表示
Hello, I am in need of some assistance performing multivariate linear regression. I am running into trouble specifically due to my output array being of size (41,2947).
I have tried using mvregress and fitlm but these don't seem to work since my output data I am trying to model an equation for is size (41,2947). Perhaps I am setting things up incorrectly?
Basically, I have two predictor (independent variables) and one output variable (dependent variable) I would like to fit an equation to as shown below.
I was able to get it working when my output array is of size(1,X) or size (X,1) but since my output array is multidimensional and relies on predictor a and b it is giving me trouble.
Any help pointing me in the right direction would be appreciated. Thank you.
%%%%%% Begin MATLAB code%%%%%%%
% First Independent Variable
predictor_a = 1:41;
% Second Independent Variable
predictor_b = 1:2947;
%The Output "surface" I would like to model with an equation
output_variable(1:41,1:2947) = 1000*randn(size(predictor_a,2),size(predictor_b,2));
%Design a meshgrid to plot the 3D surface plot
[aa,bb] = meshgrid(predictor_a,predictor_b);
waterfall(aa',bb',output_variable)
xlabel('Predictor A'); ylabel('Predictor B')
zlabel('Output (Units)')
%%%%%% End MATLAB code%%%%%%%
0 件のコメント
回答 (1 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!