Using j for imaginary numbers

I tend to use i for imaginary numbers and not j. In confirming that MATLAB is happy to use either I typed
j
and got
ans = 0 + 1.0000i
so if I wanted to go back to my electrical engineering roots and use j, can I make MATLAB say
j
ans = 0 + 1.0000j
and
i
ans = 0 + 1.0000j

 채택된 답변

Jan
Jan 2012년 5월 13일

2 개 추천

You can overload @double\display with your personal display routine. Or use:
c = 1+1j*2;
Str = evalc('display(c)');
disp(strrep(Str, 'i', 'j'));

댓글 수: 2

Daniel Shub
Daniel Shub 2012년 5월 13일
While it is a mighty big hammer, it does answer the question.
Jan
Jan 2012년 5월 13일
display(inf) replies "Inf", such that the brute replacing i->j does not bother.

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

추가 답변 (1개)

Wayne King
Wayne King 2012년 5월 11일

2 개 추천

I know this isn't a real answer, but it seemed a bit long for a comment. I'm guessing all you can do is display the result in that format
c = 1+1j*2;
sprintf('%d+%dj\n',real(c),imag(c))

댓글 수: 1

Daniel Shub
Daniel Shub 2012년 5월 13일
I think I was curious if there was a preference someplace that could be set.

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

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

질문:

2012년 5월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by