How to fit a curve using "power" fitting or "custom fitting"?
2 views (last 30 days)
Show older comments
ishita agrawal on 16 Sep 2017
Commented: ishita agrawal on 22 Sep 2017
I have data which I need to fit using following equation:
y= f(x)= a*x^b+c.
r.MarkerEdgeColor = 'r';
r.MarkerFaceColor = [0.9 0.9 0.9];
% Power fit - %y=f(x)=a*x^b+c
x = data(:);
y = a*x^b+c;
%f = fit(x,y);
p = plot(x,y)
p(1).LineWidth = 2;
c = p.Color;
p.Color = 'r';
It shows: Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
But if I use(.^), it shows multiple fit lines as shown in attached figure. I want just one fit line for same equation.
Image Analyst on 16 Sep 2017
More Answers (0)
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!