2 simultaneous curve fits on the same plot
Show older comments
Hello Everyone,
The motive of this code is to find delta of the Angle (Y-Axis). On the X- Axis the Torque Ranges from -x to +x. I want to fit two curve fit lines one when Torque >=0 and other one Torque<=0 on the same plot. Could someone help? I have attached my code and also the figure with lines how i intend to have my figure. Any suggestion or help is appreciated.
Thanks
Anand
[filename,pathname] = uigetfile('*.txt');
fullfilename = fullfile(pathname,filename);
A = importdata(fullfilename);
Torque=A(:,1);
Angle=A(:,2);
xmin=min(Torque);
xmax=max(Torque);
ymin=min(Angle);
ymax=max(Angle);
yavg=mean(Angle);
xavg=xmax;
id = (Torque >= 0);
Torque_Positive = Torque(id);
Angle_Positive = Angle(id);
it = (Torque <=0);
Torque_Negative = Torque(it);
Angle_Negative = Torque(it);
T1 = table(Torque_Positive,Angle_Positive);
T2 = table(Torque_Negative,Angle_Negative);
Answers (1)
Sai Gudlur
on 13 Dec 2018
Categories
Find more on Get Started with Curve Fitting Toolbox 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!