Bi-linear (piecewise) curve fitting
Can someone explain how to plot the two linear lines (Billinear curve fiiting) from the existing curve?
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
hello
try this (a fairly simple code)
T1 = readtable('testdata.xlsx');
x = T1.Displacement;
y = T1.BaseForce;
% top flat curve (apex)
[m,idy] = max(y);
ym = m*ones(size(y));plot(x,y,'*-',x,ym,'g','Linewidth',3);
hold on% red curve ( "yellow" net area must be zero)
% origin = 0,0 (first data point)
x1 = x(1);
y1 = y(1);% let's find out which second point of the curve let us find the min area
xx = x(1:idy);
yy = y(1:idy);for ck = 2:idy
x2 = x(ck);
y2 = y(ck);
slope = (y2-y1)/(x2-x1);
yl = y1 + slope*(xx - x1);
% compute yellow area A
A(ck) = trapz(xx,(yy-yl));
end
% find zero crossing value for A (with linear interpolation)
threshold = 0;
xx_zc = find_zc(xx,A,threshold);
yy_zc = interp1(xx,yy,xx_zc);
slope = (yy_zc-y1)/(xx_zc-x1);
yl = y1 + slope*(xx - x1);
plot(xx,yl,'r','Linewidth',3);
SEE COMPLETE ANSWER CLICK THE LINK