This could otherwise give you a large speed gain (factors of 100 or more are not uncommon). 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. Max function supports single dimensional datasets as well as multidimensional datasets. Description double is the default numeric data type (class) in MATLAB ®, providing sufficient precision for most computational tasks. jkt at 21:06 I doubt you can do it more efficiently than that. It compares all the values in integers and returns the maximum value. 2,518 3 26 28 You mean to say that your polynomial coefficients change EACH time step mathematician1975 at 21:05 yes, the coefficients change at each time step, also the coefficients are real. There is a file exchange submission by Steve Morris which finds all real roots of functions on a given interval. In Matlab ‘max’ function is used to find or calculate the maximum element from a given database. 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 am trying to show the max gain and the two cutoff frequencies for both filters. For example, solve (x + 1 2, x) solves the equation x + 1 2 for x. Plotting max gain and cutoff frequencies on a bode plot in MATLAB Ask Question Asked 3 months ago Modified 3 months ago Viewed 262 times 0 I want to highlight the differences between a simulated filter and real-life filter through a MATLAB plot. If you do not specify var, the symvar function determines the variable to solve for. I can certainly do the programming and calculation parts in Matlab, it's just a matter of being able to load in the data file, matching it to a curve or function, and find the various co-ordinates.I think that you are probably out of luck. Description example S solve (eqn,var) solves the equation eqn for the variable var. for where y is 50% and 20% of the peak found in part 1.Īre there any add-on tools or packages which people are aware of which can help me accomplish this? I need to do this for a collection of plots so something reasonably automated would be ideal.for where the plot crosses the y=0 line.I would like to have Matlab find the following points for me: I have the following plot and a file of the data which creates that plot.
0 Comments
Leave a Reply. |