2D fitting lines in 3D plot

조회 수: 5 (최근 30일)
Abhishek Mukherjee
Abhishek Mukherjee 2022년 1월 6일
답변: Abhishek Mukherjee 2022년 1월 7일
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
Abhishek Mukherjee 2022년 1월 7일
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