2D fitting lines in 3D plot

2 次查看(过去 30 天)
Hello,
I wish to put 2D curve fitting to different axis within a 3D plot. I am attaching an image for reference.
representational image on this actual data set Actual Data set
As you can see the curve fitting for x and y axis is at z=0 value, i need that at say z=10 or 20.
Further when I try to do curve fitting for x and z data set or y and z data set, the fitted curve instead of appearing on the the X-Z plane or Y-Z plane, is appearing on the X-Y plane.
All help is appreciated.

回答(1 个)

Abhishek Mukherjee
Hello,
I found a workaround using the polyfit function. Hope this helps others. Still trying to figure out how to extend the polyfit lines beyond the data points, will get there eventually.
% Curve Fitting for HS6-5-3 PM
[xData9, yData9, zData9] = prepareCurveData( Cycles_HS6_PM, SqRt_Area_HS6_PM, Tension_HS6_PM );
%Fit model to data.
y=0+zeros(42,1);
z = Tension_HS6_PM
p = polyfit(zData9, xData9,1);
x = polyval(p,z);
h=plot3(x,y,z)
h.Color = '#9475EB'; % Indigo
T = table(x,y,z,'VariableNames',{'X','Y','Z'})
%Fit model to data.
z=400+zeros(42,1);
x = Cycles_HS6_PM
p = polyfit(xData9, yData9,1);
y = polyval(p,x);
h=plot3(x,y,z)
h.Color = '#9475EB'; % Indigo
T = table(x,y,z,'VariableNames',{'X','Y','Z'})

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by