How to plot linear least square model for a data?

2 views (last 30 days)
Harsh Patel
Harsh Patel on 11 Oct 2018
Edited: KSSV on 11 Oct 2018
I have a data in form of a table
>> T = {'1';'2';'3';'4';'5';'6';'7';'8';'9';'10'};
>> X = [1;2;3;4;5;6;7;8;9;10];
>> Y = [10;20;30;40;50;60;70;80;90;100];
>> Z = [1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;11.0];
>> A = [2;4;6;8;10;12;14;16;18;20];
>> B = [1;3;5;7;9;11;13;15;17;19];
>> T = table(T,X,Y,Z,A,B)
i am new to matlab and i want to learn how to plot experimental data and use linear least square fitting to finding the relation between A-X,Y,Z and B-X,Y,Z along with equation, intercept, and r2 values. And once i get the model how can i use it to find the best combination of X,Y,Z to achieve highest (B-A) value. Thank you for the help in advance.
  1 Comment
Kevin Chng
Kevin Chng on 11 Oct 2018
Edited: Kevin Chng on 11 Oct 2018
try this first
plot(A,X)
Then you have put effort to learn from here
Hope they help you. Any specific line you have doubt, you may ask in community after you tried your ways.

Sign in to comment.

Answers (0)

Categories

Find more on Linear and Nonlinear Regression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!