필터 지우기
필터 지우기

Optimize legend command?

조회 수: 2 (최근 30일)
Muhammad Usman
Muhammad Usman 2021년 12월 8일
댓글: Muhammad Usman 2021년 12월 8일
Hi, I am struggling with LaTeX in legend, so far I wrote legend like:
legendStrings = string(n);
l = legend(legendStrings);
set(l,'interpreter','latex','string','$x^$'+string(n))
I want legend as and s on, but when I didn't write anything after ^ in string argument, MATLAB show me error.
Note:
n is an array of number and I'm plotting ananoymous function using flot withour loop.
Please optimize these lines and guide me how to display correctly.
Thanks

채택된 답변

Matt J
Matt J 2021년 12월 8일
편집: Matt J 2021년 12월 8일
For example,
plot((0:4).^2);
s=string(2);
legend("$x^"+s+"$", 'interpreter','latex')
  댓글 수: 1
Muhammad Usman
Muhammad Usman 2021년 12월 8일
Thank you so very much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by