DSPRelated.com
Forums

reading of complex values

Started by Medris July 3, 2007
I can read and plot y as input value in matlab which is meaning that the
interfacing is ok, but  x3 which is imag value appear as a real. Yes I can
change this value to imag by multiplying it by i but actually I want to
read it directly as imag from ccs.

Thank you.


>Thanks a lot for all of you for reply, in fact I am using in my work
67dsk
>and CCS 2.1 version and I used C-language for programming my project. I >would like to display my result using contour function and because this >function is not available in CCS I used interfacing function between >MatLab and ccs and it was fine, but the problem I couldn't read the >complex value I got the both values as real values. Here both codes in >matlab and cccs: > >this a part from c code in CCS: > >for( i = 0 ; i < N/2 ; i++ ) > { > W[i].re = cos(D*i);// where N is = 512 (number of FFT points) > W[i].im = sin(D*i); > } > for( i = 0 ; i <N ; i++ ) > { > x[i].re=(float)((short)input_signal[i]); > x[i].im = 0 ; > y[i]=samples[i]; > } > > digitrev_index(iTwid, N/2, 2); > bitrev(W, iTwid, N/2); > > > cfftr2_dit(x, W, N ) ; > > digitrev_index(iData, N, 2); > bitrev(x, iData, N); > > for (i=0;i<512;i++){ > //x[i].re=2.2*i; > //x[i].im=4.3*i; > x4[i]=x[i].re; > x5[i]=x[i].im; > } > > for(i=0;i<512;i++) > simt[i]=i; > > for(i=0;i<N;i++) > { > l=i+1; > if(i>0) k=1; > for(j=0;j<4;j++) > {if(l>(N-1)) l=0; >x2[i][j]=x[l].re*k*exp(-2.0*PI*PI*simt[i]*simt[i]/(1.0*(j+1)*64*64*(j+1))); >x3[i][j]=x[l].im*k*exp(-2.0*PI*PI*simt[i]*simt[i]/(1.0*(j+1)*64*64*(j+1))); > //x4[j]=exp(-2.0*PI*PI*simt[j]*simt[j]/(16.0*(5.0)*(5.0))); > l++; > } > > matlab code(just a part from my code): > >cc=ccsdsp; > > x2 = read(cc,address(cc,'x2'),'single',512); > x3 = read(cc,address(cc,'x3'),'single',512); > > y= read(cc,address(cc,'y'),'single',512); >
On 3 Jul, 19:39, julius <juli...@gmail.com> wrote:
> On Jul 3, 9:37 am, Jerry Avins <j...@ieee.org> wrote: > > [snip] > > > Now, the tools have grown so powerful that many operations require only > > a knowledge of the appropriate incantation. These sorcerers' apprentices > > just turn the crank, without knowledge of the machinery that the crank > > connects to, or even realizing that machinery is part of the process. > > > It has been some years since a CE graduate asked me how computer > > hardware distinguished between bits that represent numbers, and those > > that represent ASCII. He put me down as an ignoramus because I told him > > that was software's province. "Can't be!" > > > Programs like Matlab that let one deal with concepts without bogging > > down in details allow one to seem useful without understanding the > > concepts at all. EE seems to be going the way that CE went. > > > Jerry > > Although I agree with much of what Jerry is saying, it should be > noted that the drive to learn to apply more "advanced" science and > technology and teaching this to undergraduates means that we > have to choose and limit what the focus is.
Which is why everything fails. Using Jerry's example with the nail, one can not appreciate the function and usefulness of the compresed- air nailgun unless one have tried using at least a hammer in very awkward positions or for a long time. As far as I am concerned, the world works from a very simple principle: One can not understand -- "understand", not "use" -- the advanced stuff unless one *understands* the basic stuff. The conclusion is obvious: To teach advanced stuff, focus on the basics.
> Most of the time, it's > done by encapsulating things into nice, well-behaved "black boxes" > that the users do not have to know what is inside.
But science and engineering students are not merely *users* of black boxes; they are expected -- by me if by nobody else -- to *understand* what is inside and -- infinitely worse -- make one. Rune