How to caculate imaginary matrix in Matlab?

Status
Not open for further replies.

yorande

Advanced Member level 4
Joined
Jan 19, 2004
Messages
104
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Location
China
Activity points
905
imaginary matrix

I enter the matrix with i to denote the imaginary part.
But it seems that Matlab has ttaken it as a symbol.
Ohter symbols were defined.
And I read in a book that i is predefined for the imaginary parts.
Why can't it work in matrix?
And when I caculate a linear matrix, some of the variation answers even have "conj" part??
How could it be that?
Thanks!!!
 

example to calculate imaginary by matlab

Here's a 2x2 matrix of complex numbers:
a = [3+5i 4-7i; -2+3i -5-i];

What's that about a linear matrix and conj? Can you show us an example?
 

Hi
Be careful yorande.If you use the '*' sign between i and other variables,it will consider it as a variable if you have asigned it some value before.
So check whther you have not defined it as a variable before and also use it as echo14 has showed.I hope your problem cab be solved.
 

Remember that “j” can be used in place if “i” (as it it usual in engineering).
It is not a good idea to use “i” or “j” as variable names.
Regards

Z
 

Be careful while using variable names i and j in matlab, because by at start they r initialized as sqrt(-1) so to declare imaginary variable just write - 1+2*i.

u van declare matrix of imag nos in similar manner to that of real nos and perform simple mathematical operations such as add,substract,division .

Also u can use inbuilt funs such as conj for imaginary nos and to convert into polar form u can get angle and magnitude directly.
 

Thanks to you all!

I'm trying to caculate a matrix with something like:
[1/r1 c1*f*i 0 0 1;
0 0 g2*i 1 1]

You see, there are many symbols except numbers.
and the r1 c1 and g2 are not variables.
The problem is now the matlab just take i as a sybol as c1 too.

I have defined the r1 c1 and g2, but not i.
I thought it should take it as the imaginary part. but it did not.

And things like c1*fi or (c1*f)i did not work either.

by the way, conj means i too??
could i use conj to define the imaginary part?
 

conj is the conjugate of a complex number. For example, conj(4-5i)=4+5i.

I don't have your problem. Just to convince you. Here are the results of a series of executions:

>> r1=5; c1=4.2; f=7.5;g2=3

g2 =

3

>> A=[1/r1 c1*f*i 0 0 1; 0 0 g2*i 1 1]

A =

0.2000 0 +31.5000i 0 0 1.0000
0 0 0 + 3.0000i 1.0000 1.0000
 

most common operations on a real matrix have a slightly different form for the complex matrix. like At[i,j] = conj(A[j,i]) for a complex matrix. and MATLAB will calculate this form.
 

hi
this is an example for you
s=[1 2 3+i;1-2j 1 2;1 2 3]

s =

1.0000 2.0000 3.0000 + 1.0000i
1.0000 - 2.0000i 1.0000 2.0000
1.0000 2.0000 3.0000
>> inv(s)

ans =

-0.2353 + 0.0588i 0.1176 + 0.4706i 0.1765 - 0.2941i
0.1176 + 1.4706i -0.0588 - 0.2353i 0.4118 - 1.3529i
0 - 1.0000i 0 0 + 1.0000i
i hope that you interested
bye
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…