Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
deepak maurya
deepak maurya le 8 Août 2021
Commenté : Star Strider le 9 Août 2021
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?

Réponses (2)

KSSV
KSSV le 8 Août 2021
Read about polyfit.

Star Strider
Star Strider le 8 Août 2021
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 commentaires
deepak maurya
deepak maurya le 9 Août 2021
Thank you
I will try and accept answer once done.
Star Strider
Star Strider le 9 Août 2021
My pleasure!
.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by