Hi Experts,
I am trying to do linear regression but there is a difference in matlab and excel.
Can i what could be the reason and how to match data?

2 Kommentare

Image Analyst
Image Analyst am 13 Jul. 2020
How much of a difference? You forgot to attach your data, forgot to attach your m-file, forgot to attach your Excel script, and forgot to read this link.
Hi , sorry
Here I attached the both datas. Please check.
clear all;close all;clc;
Y= [30;36;1;26;10;12;12;34;0;47;1;49;29];
X= [21;21;19;38;50;12;35;5;17;30;46;20;48];
b= regress(Y,X)
%% output b = 0.592136616
Here I attached the both values
in matlab I a getting b= 0.5921 and in excel I am getting X = -0.213

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 13 Jul. 2020

0 Stimmen

Excel fits a striaght line to the data.....to get the same value use polyfit of MATLAB.
p = polyfit(X,Y,1) ;
p(1)

1 Kommentar

KATARI LOKESH
KATARI LOKESH am 13 Jul. 2020
HI, can you please elaborate your explanantion?
Thanks

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 13 Jul. 2020

Kommentiert:

am 13 Jul. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by