Multiple legends with a variable in a figure legend
Afficher commentaires plus anciens
Hi all,
I am trying to plot a figure with 3 curves. I need legends to the figures with varibales as legends. Here is my try. Please correct it.
figure(),
plot(x1, y1,'o', x2, y2, 'x' , coeffs(1)+x2, coeffs(2)+y2,'+')
legend('x1-y1; i-10:i','x2-y2; i+1:i+11', 'interpolated');
The above figure works fine. But need to add "i" value from the program. Hence I tried methods as follows
plot(x1, y1,'o', 'DisplayName', sprintf('x1-y1; i-10:i; i=%d', i), ...
x2, y2,'x', 'DisplayName', sprintf('x2-y2; i+1:i+11; i=%d', i), ...
coeffs(1)+x2,coeffs(2)+y2,'+','DisplayName',sprintf('Interpolated; i=%d', i));
The error is
Error using plot String argument is an unknown option.
Thanks for your attention...
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Legend dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!