Azzera filtri
Azzera filtri

How can we have a good resolution over a narrow bandwidth when we include a broad range without a lot of points?

1 visualizzazione (ultimi 30 giorni)
Hey,
I have to include a broad range frequency (around 50 GHz) in my codes, and I want to see the effect of that broad range on a small range frequency (about 200 MHz). There is a nonlinear effect that I include in my code, and that is the reason that a broad range is essential for me. Because I include this broad range, I need to have many points in my code (at least about 3E5) to have a reasonable resolution over the small range. I have a written function that calculates the effect on one point by using all other points. Indeed I can see that the more the resolution of the smaller range is, the more accurate my result would be. But this causes my code to run for extremely long times, which is not efficient for me because the result should be passed to another extended code. The reason is the more points are given to that written function, the longer time it takes to do the calculation for each frequency point. I am looking for a way to overcome this issue and obtain the same results in terms of accuracy by having fewer points and passing fewer points into that written function. I have already applied spline methods and then made a selection from the points and having fewer points in that way, but the result doesn't seem to have the same accuracy as the one with a large number of points. I have attached my code and the called function.
Any comments are so much appreciated!
  1 Commento
John D'Errico
John D'Errico il 16 Ago 2022
You tried an interpolant, but it is inadequate. You want extremely high accuracy over a small range, but you don't want to use the time to compute the amount of data you really need.
You might consider a higher order spline interpolant.

Accedi per commentare.

Risposte (1)

Pavan Sahith
Pavan Sahith il 9 Feb 2024
Hello Shaily,
It seems like you are dealing with a broad frequency range (around 50 GHz) due to the inclusion of a nonlinear effect, and you want to observe its impact on a smaller frequency range (about 200 MHz).The accuracy of your results is crucial, and you've noticed that increasing the number of points improves resolution but also significantly extends the runtime.
Now you are looking for a way to overcome this issue and obtain the same results in terms of accuracy by passing fewer points into that written function. You can try some approaches :
  • Using the 'interp1' function with cubic spline interpolation ('spline') .
% Your original frequency data
originalFreq = linspace(resf - 115E9, resf + 115E9, 3E5);
originalValues = YourOriginalFunction(originalFreq);
% Define the range of interest (about 200 MHz)
smallRangeFreq = linspace(resf - 100E6, resf + 100E6, 1000);
% Interpolate to reduce the number of points
interpolatedValues = interp1(originalFreq, originalValues, smallRangeFreq, 'spline');
% Now you can use 'smallRangeFreq' and 'interpolatedValues' for your analysis
  • You can also experiment with other interpolation methods available in MATLAB like 'pchip' , 'v5cubic' ,etc to find the optimal solution for your specific application.
  • If your calculations are independent for each frequency point, consider parallelizing your code using MATLAB's parallel computing capabilities ( 'parfor' loop). This can distribute the workload across multiple cores, potentially reducing overall computation time.
You can refer to the following MathWorks Documentation to know more about
Hoping this would help

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by