fitting data into a quadratic curve

7 次查看(过去 30 天)
Hello,
I have some data that can be fitted into a quadratic curve of y=ax^2 + bx + c. My data passes through the origin, and has a horizontal slope near the origin too. So my question is how do i force b and c to be zero in the qudratic equation ? while doing that i want to estimate the error too, so how do i keep track of the error if i have more than one quadratic equation.
I tried using fittype and polyval, and i am familiar with them, but that doesn't do my task.
I attached my data for better understanding.
Thanks for any help.

采纳的回答

Star Strider
Star Strider 2019-10-4
To force ‘b’ and ‘c’ to be zero:
B = volume_flow_rate1(:).^2 \ influence(:) % Estimate Regression Parameter
vfrv = linspace(min(volume_flow_rate1), max(volume_flow_rate1)); % Vector For Regression Evaluation
inflv = vfrv(:).^2 * B; % Evaluate Regression
figure();
plot(volume_flow_rate1,influence, '--r*' );
hold on
plot(vfrv, inflv, '-.k') % Plot Regression
hold off
xlabel ('Q (uL/s)');
ylabel ('P(Pa)');
legend ('Via');
text(25, 1200, sprintf('y = %.6f\\cdotx^2', B)) % Regression Equation
The regression parameter is:
B =
0.0266527362537937
To force only ‘c’ to be zero:
B = [volume_flow_rate1(:).^2, volume_flow_rate1(:)] \ influence(:); % Estimate Regression Parameters
vfrv = linspace(min(volume_flow_rate1), max(volume_flow_rate1)); % Vector For Regression Evaluation
inflv = [vfrv(:).^2, vfrv(:)] * B; % Evaluate Regression
figure();
plot(volume_flow_rate1,influence, '--r*' );
hold on
plot(vfrv, inflv, '-.k') % Plot Regression
hold off
xlabel ('Q (uL/s)');
ylabel ('P(Pa)');
legend ('Via');
text(25, 1200, sprintf('y = %.6f\\cdotx^2 %+.6f\\cdotx', B)) % Regression Equation
The regression parameter estimates are:
B =
0.0304986880886496
-0.722814145120915
  10 个评论
Hadi Data
Hadi Data 2019-10-15
Perfect, that worked as i wanted. And yes i am using different data.
Thank you again and again :D , I learned alot from you.
Star Strider
Star Strider 2019-10-15
As always, my pleasure!
That is actually what Answers is for!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by