## NetSpice -- Low Pass Filter Example

I'm thinking about re-visiting my text-based SPICE applet, NetSpice. Pretty cool project, but feels a bit unfinished still. Here's a quick example I just generated -- NetSpice Low Pass Filter Example.

**Posted on:**17 August 2014

I'm thinking about re-visiting my text-based SPICE applet, NetSpice. Pretty cool project, but feels a bit unfinished still. Here's a quick example I just generated -- NetSpice Low Pass Filter Example.

**Posted on:**17 August 2014

In RF layout and design, the 90 degree microstrip mitered bend (or miter bend) is a way to change the direction of a trace quickly, while maintaining the line impedance.

Here are the design equations, which I took from Microwaves101, which they took from the original work. Follow the link for a wealth of additional pertinent information. Actually I just suggest perusing Microwaves101 every once in a while -- you're sure to learn something new. Anyway, here are the equations:

D = W* SQRT(2) (the diagonal of a "square" miter)

X = D* (0.52 + 0.65 e ^ (-1.35 * (W/H)))

A = ( X- D/2) * SQRT(2)

Here's a picture to describe the variables used in the equations above:

**Posted on:**11 July 2014

Ever wonder what's behind MATLAB's roots() function?

Well, it's not really a root finding algorithm at all. It uses (I believe), the idea of Companion Matrix to cast the root finding problem into an eigenvalue problem. I won't go into the proof, but if you're familiar with the eigenvalue problem, and by extension, a matrix's characteristic polynomial, you could guess some connection might exist between polynomial root finding and the eigenvalue problem.

So, let's cook up a C++ root finding algorithm based on the companion matrix.

Once again, we're really just solving an eigenvalue problem, so there's no need to re-invent an eigensolver. Instead, we'll use Eigen to the computation. This leaves us with very little work to do. In fact, let's just skip to the code:

#include <Core>

**Posted on:**7 June 2014

Where I'm presently employed, I often proceed according to the following workflow:

- Get a Matlab / GNU Octave code of a numerical algorithm from boss, or elsewhere.
- Convert to C++ as part of my place of work's software packages.
- Over time, optimize it if it becomes oft-used, or turns out to be a bottleneck.

Obviously, Converting from Matlab code to C++ varies in difficulty based on the code. Sometimes it's easy, sometimes it's painful. The list below attempts to break down the differences between Matlab / GNU Octave and C++ into three categories. This is relatively superficial and non-technical, but here goes:

**Posted on:**28 May 2014

Say you want to rotate a point, or a vector, through some angle. This transformation is a popular one for games, scientific applications, and much more. In fact, I used it a whole bunch when I was programming my game, Not Asteroids!. All I needed to do was right-multiply a 2d vector (x,y) by the rotation matrix shown here:

..and out pops the transformed vector. If you're unfamiliar with this idea, check out the links below to get up to speed. Trust me, it's not bad.

Kwon 3d

Dr. Math

xkcd (just kidding)

Easy, right?

Okay, let's take a look at some javascript that will rotate a vector (x,y) by an angle theta, and return a 2 element array containing the rotated vector (x2,y2).:

**Posted on:**27 May 2014

In my last, post, I made mention of a page which contained a matlab-esque pseudo-code version of a block LU decomposition algorithm. But then, less than 24 hours after I posted it, the page was removed! That's life, I suppose.

Luckily, I had already drafted up a MatLab version of the pseudo-code, at least to the pre-debugging point. A few hours later, I was able to create a functional version, where the results matched that of a native GNU Octave matrix solution.

In case you didn't read the last post, and you're asking, what's the point of having my very own LU decomposition source code, here's the same response: I see your point. Libraries like LAPACK have a working, highly optimized version that's practically unbeatable on most common platforms. But what if you want to implement block LU on a new platform? Trust me, you don't want to dig through the LAPACK source -- at least not for a new version.

**Posted on:**20 May 2014

Every once in a while, I come across the following paradox: A well-written and/or extremely informative webpage about a numerical technique or method, that happens to be buried on, oh, say the fourth or fifth page of the relevant Google search result.

Many of these pages *scream* 90s internet. Think bellsnwhistles.com. Think Microsoft Frontpage Express (that's what it was called, right)? Then sprinkle in some LaTex images, add in the mathspeak, and you're pretty close to the type of page I'm taking about. I suspect something in that old-school development workflow is what keeps these pages buried in search results.

Hopefully, I can un-earth a few of these excellent pages. And hopefully, you agree they're undervalued in the eyes of Google and friends.

To start things off, here's a great webpage about Block LU Decomposition, by somebody at Indiana University.

**Posted on:**18 May 2014

I'm in the living room, which means I'm on my iPad. I was just evaluaing the usability of NetSpice with a mobile device. It...could be better.

I at least managed to create this, in a reasonable amount of time: Some Circuit

(I also found a few bugs / usability issues I need to fix -- will do this soon).

**Posted on:**17 May 2014

It's pretty easy (but unnecessary?) to compute a Bessel function of real argument, and integral order in Javascript. Instead of using the proper, more universal series definition, we'll use the integral formula:

Here's the Javascript:

function integrandeval(n,tau,x){

**Posted on:**15 May 2014

I started working on a browser-based, netlist-based SPICE interface. Why? I'm not sure, it seemed like a cool thing to do; I'm aware that there's some good web-based, schematic-based implementations already out there.

To start, I downloaded and compiled the original Spice3f5 from Berkeley. ( I think I'm going to make a tutorial about this later on, it took some work). Then I began creating a simple "Ajax"-based web-interface. You can take it for a spin here:

Here is an example that was saved via permalinking; anybody can do this to any circuit in order to share it or pass it around:

Copyright © 2017, Another Blog++. Theme by Devsaran