[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Want to know how to inluce octave fft lib in my Qt program
From: |
c. |
Subject: |
Re: Want to know how to inluce octave fft lib in my Qt program |
Date: |
Mon, 21 Oct 2013 12:22:19 +0200 |
On 21 Oct 2013, at 12:08, Prasanth N P <address@hidden> wrote:
> Ys, now I got what is top posting. Is this is the right method?
>
>
>
> I have a set of samples in an array and want to do the fft function and want
> to collect back to an array. This is my need. How can I implement this? I am
> tried to as given below.
>
> fp = fopen("buffer","r");
> if (fp == NULL)
> return 0;
>
> for (ucI=0;ucI< 1024;ucI++)
> fscanf(fp,"%d\n",&InData[ucI]);
>
>
> octave_value_list input;
>
>
> for (int i = 0; i < 1024; i++)
> {
> input (i) = InData[i];
>
> }
>
> octave_value_list output = feval ("fft", input, 1024);
>
>
> Is this is the right method? How can I collect the output to an array?
Hi,
No, it isn't, what you are doing now is equivalent to calling fft in the
interpreter with 1024 scalar inputs equal to the entries of your vector.
and you are expecting fft to return 1024 outputs while you will get only one
vector output ...
The following example should point you in the right direction (beware, this is
untested code):
fp = fopen("buffer","r");
if (fp == NULL)
return 0;
ColumnVector input_vector (1024, 0.0);
for (int ucI=0; ucI< 1024; ucI++)
fscanf(fp, "%d\n", input_vector.fortran_vec () + ucI);
octave_value_list input;
input(0) = input_vector;
octave_value_list output = feval ("fft", input, 1);
ColumnVector output_vector = output(0).column_vector_value ();
for (int ucI=0; ucI< 1024; ucI++)
std::cout << output_vector.fortran_vec ()[ucI];
HTH,
c.
- Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/07
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/07
- Message not available
- Fwd: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/09
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/09
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/10
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/12
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/17
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/17
- Message not available
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/17
- Message not available
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/21
- Re: Want to know how to inluce octave fft lib in my Qt program,
c. <=
- Message not available
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/21
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/21
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/21
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/21
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/22
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/22
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/22
- Re: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/22
- Re: Want to know how to inluce octave fft lib in my Qt program, c., 2013/10/22
- Message not available
- Fwd: Want to know how to inluce octave fft lib in my Qt program, Prasanth N P, 2013/10/24