How to smooth contour lines for the given set of data
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Madhukesh J K
il 28 Mag 2022
Risposto: Star Strider
il 28 Mag 2022
HI
I am trying to smooth the curve lines
for the given set of data
a=[0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4];
b=[0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4];
c=[0 0 0 0 0 0 0.689376362 1.378752724 2.068129087 2.757505449 0 1.02920355 2.0584071 3.087610649 4.116814199 0 1.216469264 2.432938529 3.649407793 4.865877057 0 1.325720912 2.651441823 3.977162735 5.302883646];
Anyone can help me to smooth the lines.
0 Commenti
Risposta accettata
Star Strider
il 28 Mag 2022
Increase the resolution of the vectors (and resulting matrices), and optionally define the 'method' as something other than 'linear'.
Example —
a=[0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4];
b=[0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4];
c=[0 0 0 0 0 0 0.689376362 1.378752724 2.068129087 2.757505449 0 1.02920355 2.0584071 3.087610649 4.116814199 0 1.216469264 2.432938529 3.649407793 4.865877057 0 1.325720912 2.651441823 3.977162735 5.302883646];
av = linspace(min(a), max(a), 150);
bv = linspace(min(b), max(b), 150);
[A,B] = ndgrid(av,bv);
C = griddata(a(:), b(:), c(:), A, B, 'natural');
figure
contourf(A,B,C)
Experiment to get the desired result.
.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Contour Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!