How to display pi symbol in the output?
Afficher commentaires plus anciens
how to display pi symbol instead of numerical value in the out of the given code
clc; clear all; close all;
nA=3.3;nB=2.25;
% nB=3.3;nA=2.25;
S=sign(1-(nA^2/nB^2));
x=-1i*log(S);
if x>0
disp('Zak Phase of 0th band = ')
disp(pi)
else
disp('Zak Phase of 0th band = ')
disp('0')
end
1 commentaire
sprintf('\x3c0')
double('π')
Réponse acceptée
Plus de réponses (2)
Nathan Hardenberg
le 24 Août 2023
Modifié(e) : Nathan Hardenberg
le 24 Août 2023
You can display pi as a sybolic
disp(sym(pi))
Or you can use a π-character (𝜋 or π).
disp("𝜋")
disp("π")
How about this?
S = sprintf('Zak Phase of 0th band = %c',960);
disp(S);
1 commentaire
Hiro Yoshino
le 24 Août 2023
Please refer to the list of Unicode for your help:List of Unicode characters
Catégories
En savoir plus sur Assumptions 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!