DSPRelated.com
Forums

help on abs() within matlab

Started by skyworld June 8, 2010
Hi,
I'm new to matlab and I'm developing fft matlab code for hardware
prototype. I have passed floating point code and try to verify it with
fixed point algorithm. I met problem here.
1). I use fi(x) to define input and then use fft(x) to check matlab
original results. I got message: Function 'fft' is not defined for
values of class 'embedded.fi'. Why I can't use fft() here? Is there a
solution?
2) I use complex input X, use fi(X,1,16,15) to define its type and use
fi(wn,1,16,15) to define twiddle factor. after my matlab code I got
output Y. The problem is that I can't process Y. I tried to plot Y,
but with this warning: Warning: Imaginary parts of complex X and/or Y
arguments ignored. I then try to use abs() to get its module, i.e.
re^2+im^2, but failed with this error message:Function 'fft' is not
defined for values of class 'embedded.fi'. why this happens and how
can I solve it?
Can anybody give me some help? thanks
On Jun 8, 9:28&#4294967295;pm, skyworld <chenyong20...@gmail.com> wrote:
> Hi, > I'm new to matlab and I'm developing fft matlab code for hardware > prototype. I have passed floating point code and try to verify it with > fixed point algorithm. I met problem here. > 1). I use fi(x) to define input and then use fft(x) to check matlab > original results. I got message: Function 'fft' is not defined for > values of class 'embedded.fi'. Why I can't use fft() here? Is there a > solution? > 2) I use complex input X, use fi(X,1,16,15) to define its type and use > fi(wn,1,16,15) to define twiddle factor. after my matlab code I got > output Y. The problem is that I can't process Y. I tried to plot Y, > but with this warning: Warning: Imaginary parts of complex X and/or Y > arguments ignored. I then try to use abs() to get its module, i.e. > re^2+im^2, but failed with this error message:Function 'fft' is not > defined for values of class 'embedded.fi'. why this happens and how > can I solve it? > Can anybody give me some help? thanks
Hi, is there anybody could help me?
On 6/9/2010 1:13 AM, skyworld wrote:
> On Jun 8, 9:28 pm, skyworld<chenyong20...@gmail.com> wrote: >> Hi, >> I'm new to matlab and I'm developing fft matlab code for hardware >> prototype. I have passed floating point code and try to verify it with >> fixed point algorithm. I met problem here. >> 1). I use fi(x) to define input and then use fft(x) to check matlab >> original results. I got message: Function 'fft' is not defined for >> values of class 'embedded.fi'. Why I can't use fft() here? Is there a >> solution? >> 2) I use complex input X, use fi(X,1,16,15) to define its type and use >> fi(wn,1,16,15) to define twiddle factor. after my matlab code I got >> output Y. The problem is that I can't process Y. I tried to plot Y, >> but with this warning: Warning: Imaginary parts of complex X and/or Y >> arguments ignored. I then try to use abs() to get its module, i.e. >> re^2+im^2, but failed with this error message:Function 'fft' is not >> defined for values of class 'embedded.fi'. why this happens and how >> can I solve it? >> Can anybody give me some help? thanks > > Hi, > > is there anybody could help me?
Many at comp.dsp use Matlab (I don't) but your questions would be better asked in a Matlab forum. (There is one, but I don't know its name.) Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On Jun 9, 6:14&#4294967295;am, Jerry Avins <j...@ieee.org> wrote:
> ... > Many at comp.dsp use Matlab (I don't) but your questions would be better > asked in a Matlab forum. (There is one, but I don't know its name.) > > Jerry
comp.soft-sys.matlab Dale B. Dalrymple
the thing you can check out is that fi may be a defined name for some
function... use some other name ,,, i have used fft many a times and it
does not give problem ,,,also check if data type is right ,,,we have got
data type converter for that also in matlab ... the best way is to write
fft  in help and check out  the example for settings

there are complex plots also which you can use ,,,  just go to  
communication blockset >>>sinks (in simulink ) just check its name and 
write it in help you will get the function name ,,,also yo can plot img and
real part seperately  
for eg

i=img(Y);
r=real(Y)
plot(i):hold on
plot(r)

or use the abs function 
ab=abs(Y)
plot(ab)

check the size of y,,,,(use size(y) command)
if it has more than one dimensions,, plot command  cant work  ,, start a
loop and store values in another variable (the required ones) and just do
the above mentioned commands  


if it helps tell me ,,,,or if you get problems with loop !!!!!!
On Jun 10, 1:26&#4294967295;am, "Avier" <shahanwarkhan@n_o_s_p_a_m.hotmail.com>
wrote:
> the thing you can check out is that fi may be a defined name for some > function... use some other name ,,, i have used fft many a times and it > does not give problem ,,,also check if data type is right ,,,we have got > data type converter for that also in matlab ... the best way is to write > fft &#4294967295;in help and check out &#4294967295;the example for settings > > there are complex plots also which you can use ,,, &#4294967295;just go to &#4294967295; > communication blockset >>>sinks (in simulink ) just check its name and > write it in help you will get the function name ,,,also yo can plot img and > real part seperately &#4294967295; > for eg > > i=img(Y); > r=real(Y) > plot(i):hold on > plot(r) > > or use the abs function > ab=abs(Y) > plot(ab) > > check the size of y,,,,(use size(y) command) > if it has more than one dimensions,, plot command &#4294967295;cant work &#4294967295;,, start a > loop and store values in another variable (the required ones) and just do > the above mentioned commands &#4294967295; > > if it helps tell me ,,,,or if you get problems with loop !!!!!!
thanks for the reply. I used the way you mentioned in the reply and it works. But I still prefer to use function fi because it is recommended by matlab help document -- the document don't tell me how to plot output data after you use fi. Anyway, thanks for your help.
On Jun 10, 12:41&#4294967295;am, dbd <d...@ieee.org> wrote:
> On Jun 9, 6:14&#4294967295;am, Jerry Avins <j...@ieee.org> wrote: > > > ... > > Many at comp.dsp use Matlab (I don't) but your questions would be better > > asked in a Matlab forum. (There is one, but I don't know its name.) > > > Jerry > > comp.soft-sys.matlab > > Dale B. Dalrymple
yes, I found it. Thanks.