How to Perform Multivariate Regression with Two Independent Variables on a Surface
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!