Hi,
in my project i have regular strain and stress values which i want to apply a curve fit according to (y = A + B*x^n) equation. In my code i need to take the 'A' value from a previous calculation(another curve fit). Hence in this new curve fitting operation i want to use this value however, i could not do this neither with curve fitting tool or directly from the code. Can you please offer a solution? Thank you in advance. 🙂
Here is the part of the code i tried to solve this problem.
%part i calculated the A
[xData, yData] = prepareCurveData( TruePS, Tsts );findA = fittype( 'poly4' );opts = fitoptions( 'Method', 'LinearLeastSquares' );[fitresult, gof] = fit( xData, yData, findA, opts );h = plot( fitresult,'-.r' );hold on;coeff=coeffvalues(fitresult);A=coeff(5);%part i am trying to calculate B and n.
findBN = fittype( 'A' + B*x^n , 'independent', 'x', 'dependent', 'y' );opts = fitoptions( 'Method', 'NonlinearLeastSquares' );opts.Display = 'Off';opts.StartPoint = [0.821194040197959 0.0154034376515551];[findBNresult] = fit( xData, yData, findBN, opts );
Best Answer