how to write equation in legend correctly in latex
    15 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I am trying to write following legend using latex interpreter but I keep getting this error:  
"String scalar or character vector must have valid interpreter syntax"
This is my legend information. 'a' is just a number defined in the script. Suggestions will be highly appreciated.
Dharma
 legend(['$t_{1}=t_{2}± $' num2str(a*100)])
set(legend,'Interpreter','latex');
 set(legend,'FontSize',10);
0 comentarios
Respuestas (1)
  Scott MacKenzie
      
 el 6 de Mzo. de 2022
        
      Editada: Scott MacKenzie
      
 el 6 de Mzo. de 2022
  
      MATLAB by default uses a subset of TeX.  That's probably all you need:
% test data
a=1.2345;
plot(rand(1,5));
legend(['t_{1}=t_{2}±' num2str(a*100)]);
set(legend,'FontSize',10);
0 comentarios
Ver también
Categorías
				Más información sobre Legend en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


