필터 지우기
필터 지우기

Get one best curve (graph) from 5 sets of curve.

조회 수: 1 (최근 30일)
deepak maurya
deepak maurya 2021년 8월 8일
댓글: Star Strider 2021년 8월 9일
I have 5 curves from experiments and 3 are coinciding as well as other 2 are coinciding as shown below.
But I want one curve from both sets. Or best fit from both sets: I have to insert the best fit into computational work(ANSYS).
Can you guide me with commands or ideas to write code?

답변 (2개)

KSSV
KSSV 2021년 8월 8일
Read about polyfit.

Star Strider
Star Strider 2021년 8월 8일
The plotted data all appear to have a zero intercept, so to get one slope for all of them, this works:
Set1 = [0:0.1:0.6; (0:0.1:0.6)*1.3+randn(size(0:0.1:0.6))/25];
Set2 = [0:0.1:0.7; (0:0.1:0.7)*1.1+randn(size(0:0.1:0.7))/25];
Set3 = [0:0.1:0.5; (0:0.1:0.5)*0.9+randn(size(0:0.1:0.5))/25];
Set4 = [0:0.1:0.8; (0:0.1:0.8)*0.8+randn(size(0:0.1:0.8))/25];
Set1(2,:) = Set1(2,:)-Set1(2,1);
Set2(2,:) = Set2(2,:)-Set2(2,1);
Set3(2,:) = Set3(2,:)-Set3(2,1);
Set4(2,:) = Set4(2,:)-Set4(2,1);
CommonSlope = [Set1(1,:), Set2(1,:), Set3(1,:), Set4(1,:)].' \ [Set1(2,:), Set2(2,:), Set3(2,:), Set4(2,:)].'
CommonSlope = 0.9709
CommonLine = Set4(1,:) * CommonSlope;
figure
hold on
plot(Set1(1,:), Set1(2,:))
plot(Set2(1,:), Set2(2,:))
plot(Set3(1,:), Set3(2,:))
plot(Set4(1,:), Set4(2,:))
plot(Set4(1,:), CommonLine, '--k')
hold off
Make appropriate changes to get the result you want.
.
  댓글 수: 2
deepak maurya
deepak maurya 2021년 8월 9일
Thank you
I will try and accept answer once done.
Star Strider
Star Strider 2021년 8월 9일
My pleasure!
.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by