Q format of forward FFT of fixed version of KISS FFT - fft

I have some question about fixed version kiss_fft's butterfly computation.
in "kf_bfly2", input divide by 2 use "C_FIXDIV",
in "kf_bfly3", input divide by 3 use "C_FIXDIV",
in "kf_bfly4", input divide by 4 use "C_FIXDIV",
in "kf_bfly5", input divide by 5 use "C_FIXDIV",
in "kiss_fftr" also use "C_FIXDIV",from the point of view of FFT algorithm,it's no use, It seems using "C_FIXDIV" just to prevent overflow.
but if the input is Q15, what's the output Q value?
the output Q value is consistent with input's?
whether the output magnitude is smaller than the expected?
I'm really puzzled.

Related

Octave-online.net vpa((pi-1),100) strange result?

in octave-online.net the vpa() function returns me the non precise result. If i try some computation with a lot digits behind decimal after 49's digit is the result zero. Is there some trick how to compute with a lot digits behind decimal?
vpa((pi-1),100)
returns:
2.141592653589793115997963468544185161590576171875000000000000000000000000000000000000000000000000000
I have similar problem for similar inputs with different length(e.g. vpa((113/111),100))
Thank You.
trying:
vpa((pi-1),100)
expecting:
2.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
With vpa((p-1),100) the calculation of pi-1 is done using limited precision and the (imprecise) result is then applied to the vpa function.
Instead, the vpa function needs to make the calculation:
vpa('pi-1',100)
giving the expected result:
2.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
See more details on the vpa reference page.

Cut ultrasound signal between specific values using Octave

I have an ultrasound wave (graph axes: Volt vs microsecond) and need to cut the signal/wave between two specific value to further analyze this clipping. My idea is to cut the signal between 0.2 V (y-axis). The wave is sine shaped as shown in the figure with the desired cutoff points in red
In my current code, I'm cutting the signal between 1900 to 4000 ms (x-axis) (Aa = A(1900:4000);) and then I want to make the aforementioned clipping and proceed with the code.
Does anyone know how I could do this y-axis clipping?
Thanks!! :)
clear
clf
pkg load signal
for k=1:2
w=1
filename=strcat("PCB 2.1 (",sprintf("%01d",k),").mat")
load(filename)
Lthisrun=length(A);
Pico(k,1:Lthisrun)=A;
Aa = A(1900:4000);
Ah= abs(hilbert(Aa));
step=100;
hold on
i=1;
Ac=0;
for index=1:step:3601
Ac(i+1)=Ac(i)+Ah(i);
i=i+1
r(k)=trapz(Ac)
end
end
ok, you want to just look at values 'above the noise' in your data. Or, in this case, 'clip out' everything below 0.2V. the easiest way to do this is with logical indexing. You can take an array and create a sub array eliminating everything that doesn't meet a certain logical condition. See this example:
f = #(x) sin(x)./x;
x = [-100:.1:100];
y = f(x);
plot(x,y);
figure;
x_trim = x(y>0.2);
y_trim = y(y>0.2);
plot(x_trim, y_trim);
From your question it looks like you want to do the clipping after applying the horizontal windowing from 1900-4000. (you say that that is in milliseconds, but your image shows the pulse being much sooner than 1900 ms). In any case, something like
Ab = Aa(Aa > 0.2);
will create another array Ab that will only contain the portions of Aa with values above 0.2. You may need to do something similar (see the example) for the horizontal axis if your x-data is not just the element index.

Printing a table with sage math

The assignment is to construct a two-column table that starts at x= -4 and ends with x= 5 with one unit increments between consecutive x values. It should have column headings ‘x’ and ‘f(x)’. I can't find anything helpful on html.table(), which is what we're supposed to use.
This what I have so far. I just have no idea what to put into the html.table function.
x = var('x')
f(x) = (5 * x^2) - (9 * x) + 4
html.table()
You might want to have a look at sage's reference documentation page on html.table
It contains the following valuable information :
table(x, header=False)
Print a nested list as a HTML table. Strings of html will be parsed for math inside dollar and double-dollar signs. 2D graphics will be displayed in the cells. Expressions will be latexed.
INPUT:
x – a list of lists (i.e., a list of table rows)
header – a row of headers. If True, then the first row of the table is taken to be the header.
There is also an example for sin (instead of f) with x in 0..3 instead of -4..5, that you can probably adapt pretty easily :
html.table([(x,sin(x)) for x in [0..3]], header = ["$x$", "$\sin(x)$"])
#Cimbali has a great answer. For completeness, I'll point out that you should be able to get this information with
html.table?
or, in fact,
table?
since I would say we want to advocate the more general table function, which has a lot of good potential for you.

Simulink Matlab function block deleting rows from a vector

That i want to do is to delete certain rows (or columns doesn't really mater...) from a given vector.
By going through Simulink's components found out that there is nothing performing such an operation,there are blocks help one add elements but nothing clearly for removing,so ended up trying to delete them by using a function block and following the online examples that demonstrate the usage of "[]".Lets say that i want to delete the second column of the vector u,i do u(:, 2) = [];.
That works absolutely fine in a separate m file or function but unfortunately not in a function block returning:
"Simulink does not have enough information to determine output sizes for
this block. If you think the errors below are inaccurate, try specifying
types for the block inputs and/or sizes for the block outputs."
and:
Size mismatch (size [4 x 4] ~= size [4 x 3]).
The size to the left is the size of the left-hand side of the assignment.
Function 'MATLAB Function' (#107.41.42), line 4, column 1:
"u"
Launch diagnostic report.
Is there any alternative you can suggest to remove several elements in a given vector in Simulink?
Thanks in advance
George
Finally,managed to do it without function block.There is a much easier way,by using Pad,and defining the output vector to be shorter than the input resulting in truncation.

Drawing a bar chart, but with some restriction

I want to draw a chart in linux like this:
1################# 64.85
2################### 72.84
3####################### 91.19
4####################### 91.61
5########################### 108.66
6############################ 110.69
7###################################### 149.85
8####################################### 156.60
9########################################### 169.81
I want to do that in python, of course you noticed that I don't want code like:
for i in data:
print "#"*i
because data may contain big numbers, so it is not nice to print "#" milion times.
So what is the mathematical equation that I must use to do this, I think this is a kind of mathematical problem
Thanks a lot
You have to work with percentages I think sum up all you values and then you do bar value / total of bar values
So if I have the following values 1 2 3 6 the total will be 12 so then
i will do 1 / 12 the percentage will be 8 so you print '#' 8 times and so on.
then the max # you can print is hundred.
I don't know if this is what you want, but hope this will help.