Error while performing multiple linear regression using fitlm.
6 次查看(过去 30 天)
显示 更早的评论
Hi, I am trying to perform multiple linear regression using fitlm command. For that, I have the following vectors: FuelPrice ( 1*10 vector) TotalFuelCap (1 * 10 vector) Demand (1 * 688 vector) These are the Independent variables CO2EMis ( 1 * 688 vector) This is the dependent variable.
I have coded as below:
dsa = dataset(CO2Emis ,demand, FuelPrices,TotalFuelCap','VarNames',{'CO2Emis','demand','FuelPrices','TotalFuelCap'});
T = [0 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];
X = [CO2Emis , ECost];
mdl = fitlm(X,dsa,T);
I am getting the error below: Error using dataset (line 329) All variables must have the same number of rows.
Can you please help me out.
2 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!