cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to automatically extract the range of frequency and how to find the time for maximum values

Cornel
18-Opal

How to automatically extract the range of frequency and how to find the time for maximum values

Hi,

Cornel_6-1711377730107.png

Cornel_7-1711377941104.png


1. How can I search for each frequency range?
For example I looked into the excel file and I saw that 1kHz begin from line 61536 and is ended at line 62560:

Cornel_8-1711378288579.png

.
.
.

Cornel_9-1711378316430.png


Therefore I extracted manually the respective range in Mathcad:

Cornel_10-1711378363167.png

Cornel_11-1711378383997.png

Cornel_12-1711378391342.png

Cornel_13-1711378398107.png

Cornel_14-1711378404952.png

 

 

 

So, for example I want to know between what range the 0.001Hz begging and ends, but without staying and looking into excel file, some automatic routine if can be made in Mathcad:

Cornel_15-1711378509511.png

 

And then I want to know the maximum value for Vout and Vin at the respective Frequency and at which time these maximum values are occuring:

Cornel_17-1711378637684.png

Cornel_16-1711378625038.png

Above its only the maximum value at 1kHz, but I do not know at what time these maximum values for Vout and Vin are occuring.

Cornel_18-1711378783328.png

Because I want to know then the difference between t2-t1.

1 ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:Cornel)

Using modified Werner_E's Unuque function.

image.pngimage.pngimage.png

image.png

image.png

image.png     image.pngimage.pngimage.png

image.png

image.pngimage.png

image.pngimage.png

View solution in original post

24 REPLIES 24

And these two things I want to know:
1. The maximum value for Vout and Vin at each frequency range
2. The time values t2 and t1 when maximum Vout and maximum Vin are occuring for each frequency range

For each frequency range:

Cornel_0-1711379661033.png

Cornel_1-1711379672653.png
and so on..

 

 

 

 

The spacing between frequencies:

From 0.001Hz to 0.01Hz:
Cornel_0-1711385357113.png
From 0.01Hz to 0.1Hz:

Cornel_1-1711385384730.png

 

 

and so on...till 1e6Hz

From 0.1Hz to 1Hz:

Cornel_1-1711386046427.png

 

I do not know exactly:
For example for the frequencies between 0.001Hz to 0.01Hz, and for the first frequency: 0.001

Cornel_0-1711389556926.png

Cornel_1-1711389716735.png

Cornel_2-1711389723820.png

Cornel_5-1711389815637.png

(That I knew from Excel that from 0 to 1024 is 0.001)
So, from index 0 till index 1024 the frequency 0.001Hz is located.

And so on for the next frequency 

Cornel_6-1711389978221.png
Here, above, from index 1025 till index xxxx is located frequency of 0.001259.
And so on.

Then for the next range of frequencies: from 0.01 to 0.1,,,

Cornel_7-1711389994615.png

 

Etc. A program like this I need...

Cornel_8-1711390357539.png

 

 

 



ttokoro
20-Turquoise
(To:Cornel)

image.pngimage.pngimage.png

ttokoro
20-Turquoise
(To:Cornel)

Using modified Werner_E's Unuque function.

image.pngimage.pngimage.png

image.png

image.png

image.png     image.pngimage.pngimage.png

image.png

image.pngimage.png

image.pngimage.png

Thank you, ttokoro san
Its ok this (as you have posted first time, also in the above picture seen): 

Cornel_0-1711443578035.png

not i:=0...90 as you modified in Mathcad file, because in excel file the first line is started from 1, not from 0 as in Mathcad. Of course, we can change in Mathcad Origin to 1, but its ok even like that from 0. Thus we do not need to add this:

Cornel_1-1711443676158.png
Also thanks for attached mathcad file, was more easy to understand.

I am not sure, but @Werner_E did you remember in what topic you made this Unique function, to see how this function came from, where was needed this function?

Werner_E
24-Ruby V
(To:Cornel)


I am not sure, but @Werner_E did you remember in what topic you made this Unique function, to see how this function came from, where was needed this function?

Sorry, I have no idea in which context and in which thread  I posted that function. I even can't remember that I wrote it.

There is a typo in line 2 where R.index gets initialized ("ingex" instead of "index").

Actually I wonder why the function works anyway. I would have expected an error at the first call to stack(R.index. i) because R.index is undefined.

Using the same (undefined) variable on the RHS and on the LHS in combination with a loop seems to do the job.

It also works in Mathcad. Guess I never noticed that behaviour...

Werner_E_0-1711455524966.png

 

@ttokoro 

How to skip the first line:

Cornel_0-1711456076753.png

Cornel_1-1711456085394.png

 

 

Cornel_0-1711456254508.png

ttokoro
20-Turquoise
(To:Cornel)

Use submatrix(matrix,1,last(x),0, 3)

My Prime 9 sheet add [1 1 1 10^7] to make No.90 plot. 

Unique function was made Terry, Werner, etc. It select  and find frequency block very smart programming.

I am not sure where I do wrong...

OK

Cornel_0-1711461851066.png

Cornel_2-1711461895592.png

 


NOT ok:

Cornel_1-1711461867603.png
It should look like more like this picture:

Cornel_3-1711461944667.png

 

 

 

@ttokoro 
I am not sure why for higher frequencies the time_max_in_i and time_max_out_i its calculated at such long distance:

Good:

Cornel_0-1711476386728.png

Bad:

Cornel_2-1711476474653.png

 

Cornel_1-1711476417863.png

Cornel_3-1711476506176.png

Excel file and Mathcad Prime 9 attached with data above. I think here its the problem, how these parameters are calculated:

Cornel_4-1711476776733.png
I am expected that time_max_out and time_max_in to be one after another calculated, as in the first photo GOOD for frequency of 602.55959

 


Cornel_0-1711477945641.png

Cornel_1-1711477958556.png

Cornel_2-1711478044004.png

 

 

 

Or the max value for Vin to be here:

Cornel_0-1711478394663.png

 

So, something like that I think should be the case

Cornel_0-1711478606514.png

 

Can the program be made in such a way that the search for time_max_in at Max_in and time_max_out at Max_out to be made in such a way that |time_max_out - time_max_in|<=1/freq  (sorry, I wrrite this message on the phone, but I hope is understandable)

 

Maybe a program that fiind each maximum value for Vout and Vin and each time_max_out and time_max_in for the respective maximum Vout and maximum Vin amplitudes, but for each period 1/freqi, and afterwards to choose maximum Vout amplitude/peak and time_max_out and maximum Vin amplitudes/peak and time_max_in satisfing also the condition that |time_max_out - time_max_in|<=1/freqi 

But can be also other approaches...maybe more simpler

 

| | denote absolute value

ttokoro
20-Turquoise
(To:Cornel)

Page 1 to 2 is fixed. Data has no meaning i >100 because aliasing has occure.

ttokoro
20-Turquoise
(To:Cornel)

Using FFT, cspline interporation, etc..  I have tried to solve the problem, 

Finaly, Solve block with parameterize the data block No. i of minerr function of V*sin(omega[i*t) get below plot.

image.pngimage.png

Data[150 is sampling same phase and it does not shows the sine waveform.

image.pngimage.png

image.png

Plot of Data[150.

 

image.png

Plot of Data[60 shows interpolated data as solid lines.

image.png

Please attach also mathcad file

ttokoro
20-Turquoise
(To:Cornel)

Need many try and error to solve. But the answer is very symple one.

Thank you very much, ttokoro san, I will look to it, and I will try to see

@ttokoro 

I discovered something I don't like in the dataset. I have to review the dataset because it seems something irregular that I don't like in the dataset (excel file) at high frequencies. I'll post when I figure out the things I don't like

ttokoro
20-Turquoise
(To:Cornel)

The last my sheet is using all data points of each frequency. So asuming the data is sine wave, it is one of the best answer to get maximam voltage and its phase difference for Vin and Vout.

Top Tags