Fitting Excel data in Matlab
Afficher commentaires plus anciens
Hi, I have one question.
I have a CSV file that I want to fit the data in columns 30 and 33 and I wrote the fit function to draw fit plot and data plot, but I don't know how to convert CSV file columns to a vector and give it to the function as input.
The function code is shown below.
I need your help. Thank you
function y = fit(x0,y0)
X1 = [ones(length(x0),1) x0'];
b = X1\y0'
y = b(1) + x0*b(2)
slope = b(2)
intercept = b(1)
plot(x0,y0,'o')
hold on
plot(x0,y,'--r')
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!