Group Abstract Group Abstract

Message Boards Message Boards

LogLinearPlot for Bode too slow

Posted 12 years ago
Attachments:
POSTED BY: Stefan S
9 Replies
Posted 12 years ago
POSTED BY: Stefan S
Attachments:
POSTED BY: Shenghui Yang
Posted 12 years ago

Thank your very much Shenghui!

I had the feeling that it has something to do with precomputing the function earlier instead of inverting at each point the plot takes place. I have a lot to learn!

I will go through your improved file and your examples immediately.

Thank you again for your help.

Stefan

POSTED BY: Stefan S
Posted 12 years ago

Hi Shenghui

I have been playing around and it looks very promising. The only drawback I have found is that the curves are different from the slow ones I got. It's probably a precision problem and/or the Chop function. I will continue researching on the item to see if I can improve the curves.

I will try also to force ListPlot to first substitute the f value and then compute the Inverse matrix. This could be faster, I hope.

Stefan

POSTED BY: Stefan S

Yiideal definitely takes huge amount time because it tries to inverse a matrix thousands of time across the plot domain.

Yiideal[s_] := nciM.Inverse[ZLRCideal[s]].nci

With improved code you can nailed the same plot in 0.08 sec:

improved

POSTED BY: Shenghui Yang
Posted 12 years ago

Dear Shenghui

I see that the code can be improved, but how?

Could you please explain how to do it? What should I take care off?

Thank you very much.

Stefan

POSTED BY: Stefan S
Posted 12 years ago

Without seeing exactly what you did that allowed that plot to be instantaneously changed it is impossible to respond. There is an enormous amount going on behind the curtain and perhaps with the example then someone better than I can see a way to speed your plotting up.

I suppose one alternative is to buy a PC that is (really literally) 100 times faster than the one you have, but that probably isn't practical.

POSTED BY: Bill Simpson
Posted 12 years ago

A count of the number of constants, operators and variables in just one of the items you want to plot

In[40]:= LeafCount[20 Log10[Abs[ Yiideal[2. Pi I f]]]]

Out[40]= 547063

I tried an assortment of simple things, like replacing 0.+0.I by 0, etc. and, while that removed a few tens of thousands of redundant terms, nothing made a significant dent in the half million items needed to be evaluated hundreds or likely thousands of times to make each plot.

When the function to plot is expensive I have sometimes been able to significantly speed things up by constructing a Table of equally spaced evaluations (Log spaced in this case) and then do a ListPlot with Joined->True to reduce the number of evaluations by sometimes an order of magnitude with modest reduction in the publication quality of the graph. Unfortunately with the appearance of your plots I don't think this will likely be acceptable.

POSTED BY: Bill Simpson
Posted 12 years ago

Thank you Bill. But very discouraging. So it seems that the problem is that the function is really very complex. The funny think is that I have been able to apply Manipulate to the Yiideal(s) function with good results and just moving the cursor changes the shape of the plot almost instantaneously.

Stefan

POSTED BY: Stefan S
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard