how to convert complex number into double number?

I have got this complex value from result of an equation such :( 0.7803 + 0.0000i -0.3681 + 0.5659i 0.8562 + 0.0000i -0.8941 + 0.0428i 0.7861 + 0.0000i
0.0303 + 0.8492i 0.8508 + 0.0000i -0.5537 - 0.5875i 0.7910 + 0.0000i -0.7290 - 0.2247i)
i need to convert the result to double, How?

댓글 수: 8

John D'Errico
John D'Errico 2022년 1월 24일
편집: John D'Errico 2022년 1월 24일
They ARE double precision! The real part i double precision. The imaginary part is double precision.
You cannot just hide your head in the sand and pretend they are not complex though.
@John D'Errico say I need only only one double value from this value ( x= 0.0303 + 0.8492i) , ineed to use the result in mod function : mod(x,256), because mod function dont accept complex but real value. Hence x should be real not complex, how to convert x to real ?
real(x) imag(x) abs(x) ?
@Walter Roberson i think that what i need, so thanks.
I'm sorry, but I think you are missing the point. If you need to compute a modular result from that and the variable is complex, then you did something wrong. That is why I said you should not just pretend it is real, and ignore the imaginary part. Closing your eyes to a problem does not make it go away. That only works when we are children, and even then...
@John D'Errico no matter, but please look for my code i need to compute z1, this code from one paper, the line: x(j+1)= (sin(r)); cause the complex value. how we can solve this problem?
siz=256;
x=nan(1,siz+1); %<------------PREALLOCATE!!!
y=nan(1,siz+1); %<------------PREALLOCATE!!!
Z=0.78;% initial value of control parameter Z for cofusion
E=0.95;% initial value of control parameter E for cofusion
%u=1.58;% initial value for cofusion
x(1)=0.75;% initial value
y(1)=0.2963 ; %u*x(1)*(1-x(1));%y(1) 0.2963 initial value
for j=1:siz
r=(Z/y(j))^(3/2);
x(j+1)= (sin(r));
w=(E*acos(x(j)));
y(j+1)=(cos(w));
end
xx=(x(2:siz+1)*10^14);
dd=round(xx);
z1=mod(dd,siz);
We have no idea what you are trying to do. Some background would be helpful. You are obviously going to get complex results when cos(w) goes negative. You could force y to be positive by abs(cos(w)), but just like John said you cannot hide your head in the sand. We don't know what you are modeling or doing, so we can't help you.
@David Hill i need to implement this function in attached image to get sequence values for x and with initial value as in program......

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

 채택된 답변

siz=256;
x=nan(1,siz+1); %<------------PREALLOCATE!!!
y=nan(1,siz+1); %<------------PREALLOCATE!!!
Z=0.78;% initial value of control parameter Z for cofusion
E=0.95;% initial value of control parameter E for cofusion
%u=1.58;% initial value for cofusion
x(1)=0.75;% initial value
y(1)=0.2963 ; %u*x(1)*(1-x(1));%y(1) 0.2963 initial value
for j=1:siz
r=(Z/y(j));
x(j+1)= sin(r).^(3/2);
w=(E*acos(x(j)));
y(j+1)=(cos(w));
end
plot(x, y)

댓글 수: 2

@Walter Roberson Thanks alot for your help, but all values not chaotic as auther of this function indicate in his paper, so i think there is something wrong.
Sorry, I do not know. I am not able to reproduce the authors' plots.

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2014a

질문:

2022년 1월 24일

댓글:

2022년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by