[Top][All Lists]

[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: Prasanth N P
Subject: Re: Want to know how to inluce octave fft lib in my Qt program
Date: Mon, 28 Oct 2013 15:36:32 +0530

On Sat, Oct 26, 2013 at 12:13 PM, Prasanth N P <address@hidden> wrote:

On Fri, Oct 25, 2013 at 10:42 AM, Prasanth N P <address@hidden> wrote:

On Thu, Oct 24, 2013 at 8:18 PM, c. <address@hidden> wrote:

On 24 Oct 2013, at 12:07, Prasanth N P <address@hidden> wrote:

> . I need the output as float or double.

It is OK if you want to stick to C-style IO but to do it correctly you have to use %g instead of %d.
the results you get are wrong because you input your data incorrectly.


Can anybody help me in solving this problem.

I have to do the fft of a set of samples with Octave interpreter function in C++. I want to get the same result set as those obtained from octave prompt. My input is a file 'buffer' with 1024 number of samples. My octave program is.

  load 'buffer'
  setenv ("GNUTERM", "x11")
  V = abs(v);
  save output V;

and final ouput saved in a file 'output'.

and my c++ interpreter program is

  ColumnVector input_vector (1024, 0.0);

  fp = fopen("buffer","r");
  if (fp == NULL)
  return 0;
  for (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);  
  octave_value_list final_output = feval ("abs", output, 1);    
  ColumnVector output_vector = final_output(0).column_vector_value ();

and also result set saved in a file 'output'. I have got two entirely different plot with these two, please check those two attached below. Is there any issue with my c++ code? Please help me asap.


Attachment: octave_prompt.jpg
Description: JPEG image

Attachment: c++_interpreter.jpg
Description: JPEG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]