How to display pi symbol in the output?
์กฐํ ์: 212 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
GULZAR
2023๋
8์ 24์ผ
๋๊ธ: Hiro Yoshino
2023๋
8์ 24์ผ
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
์ฑํ๋ ๋ต๋ณ
Dyuman Joshi
2023๋
8์ 24์ผ
You can either use the symbolic math toolbox or print the symbol via the unicode value -
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 = ')
%pi as a symbolic number
disp(sym(pi))
%print the symbol via unicode value
fprintf('%c', 960)
else
disp('Zak Phase of 0th band = ')
disp('0')
end
๋๊ธ ์: 0
์ถ๊ฐ ๋ต๋ณ (2๊ฐ)
Nathan Hardenberg
2023๋
8์ 24์ผ
ํธ์ง: Nathan Hardenberg
2023๋
8์ 24์ผ
You can display pi as a sybolic
disp(sym(pi))
Or you can use a ฯ-character (๐ or ฯ).
disp("๐")
disp("ฯ")
๋๊ธ ์: 0
Hiro Yoshino
2023๋
8์ 24์ผ
How about this?
S = sprintf('Zak Phase of 0th band = %c',960);
disp(S);
๋๊ธ ์: 1
Hiro Yoshino
2023๋
8์ 24์ผ
Please refer to the list of Unicode for your help:List of Unicode characters
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Symbolic Math Toolbox์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!