help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

invalid conversion from string to real scalar using fft and ifft functio


From: RT
Subject: invalid conversion from string to real scalar using fft and ifft function - how can I fix
Date: Sat, 23 Jan 2016 06:27:31 -0500

I'm trying to frequency shift a signal by a fractional amount using IFFT and FFT but I keep getting a error "invalid conversion from string to real scalar"  which I don't know how to fix.  I've tested it using octave 3.8.1 and octave 4.0 using ubuntu 14.04. 

I did find a bug http://savannah.gnu.org/bugs/?42235 but I'm not sure how to fix it related to fft and ifft.  I posted test code below:

clear all,clf,tic

Fs=44100;

t=linspace(0,1,Fs);

sig_in=.5*sin(2*pi*1*t)+.2*cos(2*pi*3*t); %sin(2*pi*1*t);


y=ifft(sig_in);

freq_shift=1.3;

N=length(y);

mult = exp(-1i*2*pi/N*(0:N-1)*freq_shift);


shifted_sig=ifft((fft(y).*mult ),'symmetric'); %error here -invalid conversion from string to real scalar-


plot(t,sig_in,'-r',t,shifted_sig,'-b')




reply via email to

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