Ältere Kommentare anzeigen
When plotting a scatter plot is it possible to add a linear fit to the the graph without having to go into tools-> basic fitting and clicking on linear and show equations?
Akzeptierte Antwort
Weitere Antworten (5)
Thomas
am 31 Jan. 2012
1 Stimme
Also you can always do it once manually, generate data set, create the plot, make the linear fit with the equations, then in the Figure window
File>Generate code..
This will create a MATLAB function for everything that you did manually and can use it again and again if you have more data sets.
1 Kommentar
Galina Machavariani
am 2 Sep. 2021
After I did linear fit with equation, What should I write in the command window to generate the code?
Wayne King
am 31 Jan. 2012
Hi, yes, you can use lsline()
x = 1:10;
y1 = x + randn(1,10);
scatter(x,y1,25,'b','*')
hold on;
lsline;
4 Kommentare
Richard
am 31 Jan. 2012
Wayne King
am 31 Jan. 2012
lsline(), not isline. Did you copy and paste my code? I didn't write isline.
Richard
am 1 Feb. 2012
vkehayas
am 30 Sep. 2016
The statistics toolbox is required for
lsline
Annu Panwar
am 13 Sep. 2017
0 Stimmen
but anyone has observed that the results are different when you do polyfit by using codes and manually?
sabreen haj
am 27 Apr. 2018
0 Stimmen
Can you help me to write script for calibration curve And give me the equation so i can finde the x value then the result shown in a table with everage of 3 x value and std
Marcello Wienhoven
am 11 Jan. 2021
0 Stimmen
x = 1:10;
y1 = x + randn(1,10);
scatter(x,y1,25,'b','*')
P = polyfit(x,y1,1);
yfit = P(1)*x+P(2);
hold on;
plot(x,yfit,'r-.');
1 Kommentar
Galina Machavariani
am 2 Sep. 2021
Thank you for the answer.
And how can I display linear fit equation on the graph?
I mean not "manual" way in the graph editor, , but the code ...
Thank you !
Kategorien
Mehr zu Linear Predictive Coding finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
