Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
deepak maurya
deepak maurya el 8 de Ag. de 2021
Comentada: Star Strider el 9 de Ag. de 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?

Respuestas (2)

KSSV
KSSV el 8 de Ag. de 2021
Read about polyfit.

Star Strider
Star Strider el 8 de Ag. de 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 comentarios
deepak maurya
deepak maurya el 9 de Ag. de 2021
Thank you
I will try and accept answer once done.
Star Strider
Star Strider el 9 de Ag. de 2021
My pleasure!
.

Iniciar sesión para comentar.

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by