Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
deepak maurya
deepak maurya il 8 Ago 2021
Commentato: Star Strider il 9 Ago 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?

Risposte (2)

KSSV
KSSV il 8 Ago 2021
Read about polyfit.

Star Strider
Star Strider il 8 Ago 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.
.

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by