G2 = (1.5791e08*(2*pi*fin*1j).^2)./((2*pi*fin*1j+1.257e04).^2.*((2*pi*fin*1j).^2 + 62.83*(2*pi*fin*1j) + 987)) ĥ.- ** bode ** and ** bodeplot ** are slowīode and bodeplot are useful functions but both are slow compared to working directly the the available data.Īlso the transfer function looks like a LPF but there's a notch when really close to 0Hz.ĭo you really want DC through? Perhaps not the best choice of filter. Manually one can check expected results :Īnd despite having the graphic handle, plot cannot direct the new trace onto the generated graph. = Īs asked there were 94 input frequencies, now you have 1e3 frequencies, but squeeze is needed to remove void dimensions because bode, for whatever reason, produces 1x1xN values, not just 1xN. New images of the sun’s surface captured by a powerful ground-based solar telescope have revealed sunspots and other features in unprecedented detail. example f realmax (precision) returns the largest finite floating-point number in IEEE single or double precision. G = (1.5791e08*s^2)/((s+1.257e04)^2*(s^2 + 62.83*s + 987)) Description example f realmax returns the largest finite floating-point number in IEEE double precision. I am not sure how to calculate the cutoff frequency. I was able to get the max gain values by using the getPeakGain function and then converting to dB and Hz. ![]() ![]() Ideally, each point on the bode plot would be shown by a circle with a dotted line down to the x-axis. I am trying to show the max gain and the two cutoff frequencies for both filters. Description double is the default numeric data type (class) in MATLAB ®, providing sufficient precision for most computational tasks. This could otherwise give you a large speed gain (factors of 100 or more are not uncommon).I want to highlight the differences between a simulated filter and real-life filter through a MATLAB plot. This could both be beneficial, because calls to non-builtin functions inside a loop prevent Matlab's JIT compiler from translating the loop to machine language. Also, roots does nothing more than find the eigenvalues of the companion matrix, so you could find these eigenvalues yourself, which prevents a call to roots. This allows you to find only one (or a few) roots and save time (there's a fair chance it's also possible to compute the roots or extrema of a Chebychev analytically, although I could not find a good reference for that (or even a bad one for that matter.)).Īnother attempt that you can make in speeding things up, is to note that polyder does nothing more than Pprime = (numel(P)-1:-1:1). You can modify the eig evaluation of the companion matrix in there, to eigs. It does so by interpolating the polynomial by a Chebychev polynomial, and finding its roots. There is a file exchange submission by Steve Morris which finds all real roots of functions on a given interval. I could be completely wrong here but you might just be out of luck in getting something faster unless you can provide more information of have some kind of relationship between the polynomials generated at each step. There is insufficient information available to consider calculating just a subset of roots of the derivative polynomial - how could you know which derivative root provides the maximum stationary point of the polynomial without comparing the function value at ALL of the derivative roots? If your polynomial coefficients were being perturbed at each step by only a (bounded) small amount or in a predictable manner, then it is conceivable that you would be able to try something iterative to refine the solution at each step (for example something crude such as using your previous roots as starting point of a new set of newton iterations to identify the updated derivative roots), but the question does not suggest that this is in fact the case so I am just guessing. If the coefficients of the polynomial change at every time step in an arbitrary fashion, then ultimately you are faced with a distinct and unrelated optimisation problem at every stage. ![]() I think that you are probably out of luck.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |