Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bart Plovie  >  Nodal Analysis  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example network
Class: Nodal Analysis
Perform nodal analysis of linear circuit networks
Author: By
Last change:
Date: 2010-05-31 13:17
Size: 768 bytes
 

Contents

Class file image Download
This script solves the following network:<br />
<img src="network.jpeg"><br />
<pre>
<?php
    
require_once('nodal.class.php');
    
    
$nodal = new Nodal();
    
$nodal->setnodes(4);
    
$nodal->refnode(0);
    
$nodal->connection(0120000'AB');
    
$nodal->connection(021000090'AC');
    
$nodal->connection(031500000'AB');
    
$nodal->connection(122000'BC');
    
$nodal->connection(23500000'CD');
    
$nodal->connection(13100000'BD');
    
    
$table $nodal->connectiontable();
    echo 
"<table>";
    foreach(
$table as $trow)
    {
        echo 
"<tr>";
        foreach(
$trow as $element)
        {
            echo 
"<td>$element</td>";
        }
        echo 
"</tr>";
    }
    echo 
"</table>\n\nResults:";
    
$nodal->calculate();
    
print_r($nodal->results());
?>
</pre>