Advice needed on Regression functions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hey everyone,
I am doing a project for physics lab where I have to analyze data for of a Frank Hertz experiment current vs. accelerating voltage for Neon. I need to do a polynomial regression curve fitting for the following data values of A against the model function a*x^2+b*x+c:
X = [57.0, 58.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 65.9] Y = [-29.4, -30.195, -33.858, -36.262, -39.612, -43.236, -47.460, -52.589, -57.356]
I tried polyeval() with an order = 2 fit; however, it seems that the data is so bad that the value of a was a > 0 instead of a<0 .
I was wondering if anyone could provide advice about what I should do next. Is their a way in matlab's regression functions to assign specific conditionals or boundaries for the parameters? Or can someone suggest another statistical fit that would produce a maximum?
Sincerly,
Michael
0 comentarios
Respuesta aceptada
the cyclist
el 20 de Jun. de 2011
Rather than just describing what you did, I suggest you post your code. Maybe you made some syntax error.
This looks pretty good to me:
X = [57.0, 58.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 65.9];
Y = [29.4, 30.195, 33.858, 36.262, 39.612, 43.236, 47.460, 52.589, 57.356]
p = polyfit(X,Y,2)
figure
hold on
plot(X,Y,'.')
plot(X,p(1)*X.^2+p(2)*X+p(3))
Ordinarily, one could use polyval() in that last step, but I wanted to illustrate exactly how the coefficients work out.
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!