Tell me more ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

SPICE is a great tool, but I want to be able to write my own code in MATLAB such that I can get faster results.

To start with, I have a simple but specific requirement. Once I understand and can complete this circuit simulation using MATLAB for this specific case, then I will attempt to generalise for similar circuits.

I have a grid of resistors each of 1 Ohm arranged in a repeating square pattern.

(Where | represents an 1 Ohm resistor. As you can see my pathetic illustration is attempting to show the square pattern of the resistors.) At each intersecting node, there is a current source in parallel with a diode connected to ground.

All current sources have a known value. All resistors are known.

Clearly there are a few ways to look at this but having the diodes.

Ideally, I want to solve this in a manner that is easy to follow and also is in an efficient manner which would lend itself to bigger circuits. I would like to generate the node voltages at each point. Also, how does SPICE complete a DC sweep, as I would like to perform a DC sweep across the circuit?

share|improve this question
Sorry but I do not have the rep to upload an image and I am unable to draw it in ascii art due to the formatting set up. – user1011182 Dec 2 '11 at 16:52
This question is probably going to be shot down quickly as off-topic here. You might try the Electronics SE. However, honestly if these are the questions you are asking, you have zero chance of building something that will perform better than SPICE. – user2963 Dec 2 '11 at 16:58
The usual way to draw ASCII art it to use "code" formatting (i.e. four space at the beginning of the line or use the "{}" button). Alternately you can link to a offsite image and someone could edit it in for you. – dmckee Dec 2 '11 at 17:28
1  
As for on- versus off-topic, in what way is this a physics question? Surely you understand the basics of Ohm's law, which is what you need for the resistor grid. What happens at the diode is more complex. If you want to know what spice (at least what ngspice or the Berkeley 3f5 version do) does, you could read the source. As an aside, I'd be very surprised if you could make matlab run faster than spice. – dmckee Dec 2 '11 at 17:33
I echo zephyr's suggestion to look at Electrical Engineering, though I don't know whether they would be interested in this question. Alternatively, it might be okay to ask at the Scientific Computing site once it reaches public beta (which will be in a few days). Here, though, it's not appropriate for essentially the reason dmckee gave. – David Zaslavsky Dec 2 '11 at 18:12

closed as off topic by David Zaslavsky Dec 2 '11 at 18:12

Questions on Physics Stack Exchange are expected to relate to physics within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.