Legend for a graph displaying multiple runs
Ältere Kommentare anzeigen
Hello,
I have a working code for calculation of agch. I now want to see how different values of input Z affect the final results. I managed to plot runs with different Z values on one graph using hold on.
function [angle, alpha, al, agch, Al, Ag] = getanglech
[D, A, R] = geom();
[n, m] = setglblch();
X = setX();
[Xlm, aglm] = martineli();
for Z = 5:20
angle = arrayfun( @(X) fzero( @(angle) equationsch (angle, X, D, A, R, m, n, Z) , [1E-4, pi-1E-4]), X );
Ag = (R^2)*(pi-angle+0.5*sin(2*angle)) ;
Al = (R^2)*(angle-0.5*sin(2*angle)) ;
Slw = 2*R*angle ;
alpha = (4*Al)./(Slw*D) ;
al = Al/A ;
agch = Ag/A ;
p=loglog(Xlm, aglm, 'o', X, agch);
p(1).MarkerEdgeColor = [0 0 0 ];
xlabel('X')
ylabel('ag')
legend ('Martinelli', 'Chisholm')
legend('Location','best')
hold on
end
end
However, the legend is messy (picture attached). It should be clear in the plot which value of Z each line represents. Also, the Martinelli data should only have on entry in the legend and not every second. Can this be done? Any help appreciated.

%
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Legend finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!