MATLB - how to show REAL numbers only

In summary, MATLAB is a high-level programming language and interactive environment commonly used in scientific research and engineering for data analysis, mathematical modeling, and algorithm development. To show real numbers only in MATLAB, the <code>real</code> function can be used. Complex numbers can be converted to real numbers using this function. To display only real numbers in a plot, the <code>real</code> function can be applied to the data. However, complex numbers may still be displayed in MATLAB if the data contains both real and imaginary components.
  • #1
Curl
758
0
I'm trying to use the MATLAB symbolic toolkit, but the "conj" term keeps annoying me. Here's an example:

>>syms l d
>>A=[l d ; d*l -l*l*d]
>>A'
ans =

[ conj(l), conj(d)*conj(l)]
[ conj(d), -conj(d)*conj(l)^2]

How do I tell MATLAB I'm only interested in real numbers, and get rid of the conj terms? My applications do not involve any imaginary numbers at all.

Thanks
 
Physics news on Phys.org
  • #2
Code:
syms [COLOR="Purple"]l d real[/COLOR];
 
  • #3
I appreciate it.
 

What is MATLAB?

MATLAB is a high-level programming language and interactive environment for numerical computation, visualization, and programming. It is commonly used in scientific research and engineering for data analysis, mathematical modeling, and algorithm development.

How do I show real numbers only in MATLAB?

To show real numbers only in MATLAB, you can use the real function. For example, if you have a complex number z = 3+4i, using real(z) will return 3, the real part of the number.

Can I convert a complex number to a real number in MATLAB?

Yes, you can convert a complex number to a real number in MATLAB by using the real function. This will return the real part of the complex number as a float or integer.

How do I display only real numbers in a plot in MATLAB?

You can display only real numbers in a plot in MATLAB by using the real function on the data you want to plot. This will ensure that only the real part of the data is plotted and the imaginary part is ignored.

Why are complex numbers sometimes displayed in MATLAB?

Complex numbers are displayed in MATLAB when the data being used contains both real and imaginary components. This is because MATLAB is designed to handle complex numbers and display them in the standard form a+bi, where a is the real part and b is the imaginary part.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Calculus and Beyond Homework Help
Replies
13
Views
2K
Replies
85
Views
4K
  • Introductory Physics Homework Help
Replies
25
Views
259
Replies
2
Views
946
Replies
14
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
305
Replies
5
Views
845
  • Classical Physics
Replies
0
Views
97
Back
Top