From: Guilherme Brondani Torri <guitorri@gm...>  20140610 12:13:47

Hi Neil, Good to know it is working. In fact, the max(x,[,range]) is only documented on the Help, not on our manuals/tutorials: http://qucs.sourceforge.net/docs.html http://qucs.sourceforge.net/docs/tutorial/functions.pdf I also had some issues with positive and negative cost functions. I never looked in detail to check what was the reason. I some cases changing the sign worked for me. I any case, ASCO is the optimizer, you can find the manual over here: http://asco.sourceforge.net/manual.html Regards, Guilherme On 6/10/14, 11:03 AM, Neil Thomas wrote: > Hi Guilherme, > > I hadn't seen that example before. But then I was starting from Studio > 2.1.0, which has a very thin help section. It optimises a DC resistor > value with no frequency dependence, hence my not knowing how to > specify frequency. I've switched to Qucs 0.0.17, I'm not sure whether > that's an important part of the solution, and I'm not going to switch > back and find out. Also in help, 0.0.17 documents the max(x,range) > function, which 2.1.0 doesn't. I'm not sure what the Studio project > was trying to acheive, but leaving out useful examples and > documentation is not an improvement. > > 'Making Qucs aware of frequency' is what the fmin:fmax range does in > the max() function when used like this >> passband = max(dB(S[2,1]), > fmin:fmax). > > I'm now getting an optimisation to run. I've had 'can't have negative > cost' errors when trying to maximise the passband, but asking it to be > equal to 1 seems to work OK and expresses much the same goal. I'll > play with refining the expression of goals later, but at least the > syntax is now working. > > thanks for your help. > > regards > Neil > > On 09/06/2014 18:05, Guilherme Brondani Torri wrote: >> On 6/9/14, 4:24 PM, Neil Thomas wrote: >>> Hi, >>> >>> I am just getting started with Qucs, using QucsStudio 2.1.0. My first >>> toy circuit simulation of a parallel inductor and capacitor fed by a >>> resistor from a source works just fine. The AC sweep shows the expected >>> resonance. I have named my output node 'output', and am plotting >>> output.v. Now I wish to try out the optimiser, to change the inductor >>> value to move the peak to a specific frequency. >>> >>> I think I need to write an equation to extract the gain at the target >>> frequency, which I can then maximise. My AC frequency sweep goes 10MHz >>> to 1GHz with 90 points per decade, or 181 elements. I have not yet >>> found >>> how to write a legal equation of the form 'X=gain_at_f_target'. Having >>> read read the 'mathematical functions' part of the documentation, >>> how to >>> access vectors, I tried X=output.v[100]. It complains that there is no >>> function. X=output.v[500e6] gives the same error. X=yvalue(output.v, >>> 500e6) looked as if it would do the trick, but is only allowed on >>> diagrams. X=dBm(output.v[100]) also says there's no function there. >>> >>> I have searched the documentation, and spent a day with google and >>> various combinations of 'optimiser qucs equation function frequency' to >>> no avail. I did look at the examples page, but the .sch seem to be the >>> wrong format, there didn't seem to be any optimisation ones available >>> either. >>> >>> I'm sure it's just simple syntax I'm missing, perhaps so obvious that >>> I've missed it. >>> >>> How do I make the optimiser aware of frequencies in the simulation? >>> >>> Or should I be driving the optimiser in a different way? >>> >>> Thanks for your help. >>> >>> Neil >>> >>> >> Hi Neil, >> >> Have you seen the examples on the Getting Started from the Help menu? >> There is one about "Getting Started with Optimization". Also >> accessible in [1]. >> >> I haven't tried slicing an array, but perhaps using the max / min and >> the frequency range would be more robust. >> >> The optimizer takes cost functions (constraints) which it tries to >> optimize for. >> >> What do you mean by "make the optimizer aware of frequencies"? >> >> I hope it helps. >> >> Regards, >> Guilherme >> >> [1] >> http://www.gnudarwin.org/www001/src/ports/cad/qucs/work/qucs0.0.12/qucshelp/docs/en/start_opt.html >> > 