From: Guilherme Brondani Torri <guitorri@gm...>  20140609 17:05:24

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 